#! /bin/sh # Generated from local.at by GNU Autoconf 2.71. # # Copyright (C) 2009-2017, 2020-2021 Free Software Foundation, Inc. # # This test suite is free software; the Free Software Foundation gives # unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} # How were we run? at_cli_args="$@" # Not all shells have the 'times' builtin; the subshell is needed to make # sure we discard the 'times: not found' message from the shell. at_times_p=false (times) >/dev/null 2>&1 && at_times_p=: # CLI Arguments to pass to the debugging scripts. at_debug_args= # -e sets to true at_errexit_p=false # Shall we be verbose? ':' means no, empty means yes. at_verbose=: at_quiet= # Running several jobs in parallel, 0 means as many as test groups. at_jobs=1 at_traceon=: at_trace_echo=: at_check_filter_trace=: # Shall we keep the debug scripts? Must be `:' when the suite is # run by a debug script, so that the script doesn't remove itself. at_debug_p=false # Display help message? at_help_p=false # Display the version message? at_version_p=false # List test groups? at_list_p=false # --clean at_clean=false # Test groups to run at_groups= # Whether to rerun failed tests. at_recheck= # Whether a write failure occurred at_write_fail=0 # The directory we run the suite in. Default to . if no -C option. at_dir=`pwd` # An absolute reference to this testsuite script. case $as_myself in [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;; * ) at_myself=$at_dir/$as_myself ;; esac # Whether -C is in effect. at_change_dir=false # Whether to enable colored test results. at_color=auto # As many question marks as there are digits in the last test group number. # Used to normalize the test group numbers so that `ls' lists them in # numerical order. at_format='???' # Description of all the test groups. at_help_all="1;m4.at:21;Generating Comments;; 2;input.at:27;Invalid number of arguments;; 3;input.at:58;Invalid options;; 4;input.at:83;Invalid inputs;; 5;input.at:147;Invalid inputs with {};; 6;input.at:173;Yacc warnings on symbols;; 7;input.at:204;Yacc warnings;; 8;input.at:238;Yacc's %type;; 9;input.at:287;Invalid symbol declarations;; 10;input.at:341;Redefining the error token;; 11;input.at:401;Dangling aliases;; 12;input.at:427;Symbol declarations;; 13;input.at:528;Invalid \$n and @n;; 14;input.at:552;Type Clashes;; 15;input.at:774;Unused values;; 16;input.at:784;Unused values before symbol declarations;; 17;input.at:794;Symbol redeclared;; 18;input.at:832;EOF redeclared;; 19;input.at:859;Symbol class redefinition;; 20;input.at:899;Default %printer and %destructor redeclared;; 21;input.at:970;Per-type %printer and %destructor redeclared;; 22;input.at:1013;Undefined symbols;; 23;input.at:1045;Unassociated types used for a printer or destructor;; 24;input.at:1074;Useless printers or destructors;; 25;input.at:1139;Unused values with default %destructor;; 26;input.at:1187;Unused values with per-type %destructor;; 27;input.at:1219;Duplicate string;; 28;input.at:1247;Token collisions;; 29;input.at:1275;Incompatible Aliases;; 30;input.at:1400;Torturing the Scanner;; 31;input.at:1569;Typed symbol aliases;; 32;input.at:1609;Require 1.0;; 33;input.at:1610;Require 3.8.2;; 34;input.at:1612;Require 100.0;; 35;input.at:1619;String aliases for character tokens;; 36;input.at:1642;Symbols;; 37;input.at:1708;Numbered tokens;; 38;input.at:1750;Unclosed constructs;; 39;input.at:1805;%start after first rule;; 40;input.at:1826;Duplicate %start symbol;multistart; 41;input.at:1895;%prec takes a token;; 42;input.at:1916;%prec's token must be defined;; 43;input.at:1936;Reject unused %code qualifiers;; 44;input.at:2025;Multiple %code;; 45;input.at:2065;errors;; 46;input.at:2102;%define, --define, --force-define;; 47;input.at:2170;\"%define\" Boolean variables;; 48;input.at:2191;\"%define\" code variables;; 49;input.at:2224;\"%define\" keyword variables;; 50;input.at:2257;\"%define\" enum variables;; 51;input.at:2320;\"%define\" file variables;; 52;input.at:2342;\"%define\" backward compatibility;; 53;input.at:2393;Unused api.pure;; 54;input.at:2429;C++ namespace reference errors;; 55;input.at:2482;Bad character literals;; 56;input.at:2543;Bad escapes in literals;; 57;input.at:2582;Unexpected end of file;; 58;input.at:2675;LAC: Errors for %define;lac; 59;input.at:2719;-Werror combinations;; 60;input.at:2764;%name-prefix and api.prefix are incompatible;; 61;input.at:2793;Redefined %union name;; 62;input.at:2840;Stray \$ or @;; 63;input.at:2883;Code injection;; 64;input.at:2946;Deprecated directives;deprec; 65;input.at:3077;Unput's effect on locations;deprec; 66;input.at:3113;Non-deprecated directives;deprec; 67;input.at:3148;Cannot type action;; 68;input.at:3171;Character literals and api.token.raw;; 69;input.at:3205;%token-table and parse.error;; 70;input.at:3231;Invalid file prefix mapping arguments;; 71;named-refs.at:22;Tutorial calculator;; 72;named-refs.at:196;Undefined and ambiguous references;; 73;named-refs.at:297;Misleading references;; 74;named-refs.at:316;Many kinds of errors;; 75;named-refs.at:551;Missing identifiers in brackets;; 76;named-refs.at:567;Redundant words in brackets;; 77;named-refs.at:583;Comments in brackets;; 78;named-refs.at:599;Stray symbols in brackets;; 79;named-refs.at:618;Redundant words in LHS brackets;; 80;named-refs.at:635;Factored LHS;; 81;named-refs.at:648;Unresolved references;; 82;named-refs.at:715;\$ or @ followed by . or -;; 83;output.at:68;Output files: -dv;; 84;output.at:74;Output files: -dv >&-;; 85;output.at:81;Output files: -dv -o foo.c;; 86;output.at:84;Output files: -dv -y;; 87;output.at:87;Output files: api.header.include={\"./foo.h\"} -dv -y;; 88;output.at:92;Output files: -dv -o foo.tab.c;; 89;output.at:95;Output files: --fixed-output-files -dv -g --html;; 90;output.at:97;Output files: -Hfoo.header -v -gfoo.gv --html=foo.html;; 91;output.at:100;Output files: -dv -g --xml --fixed-output-files;; 92;output.at:102;Output files: -dv -g --xml -y;; 93;output.at:104;Output files: %require \"3.4\" -dv -g --xml -y;; 94;output.at:107;Output files: -dv -g --xml -o y.tab.c;; 95;output.at:110;Output files: -dv -b bar;; 96;output.at:112;Output files: -dv -g -o foo.c;; 97;output.at:116;Output files: %header %verbose ;; 98;output.at:118;Output files: %header %verbose %yacc ;; 99;output.at:121;Output files: %header %verbose %yacc ;; 100;output.at:125;Output files: %file-prefix \"bar\" %header %verbose ;; 101;output.at:127;Output files: %output \"bar.c\" %header %verbose %yacc ;; 102;output.at:129;Output files: %file-prefix \"baz\" %output \"bar.c\" %header %verbose %yacc ;; 103;output.at:136;Output files: %header %verbose ;; 104;output.at:139;Output files: %header %verbose -o foo.c;; 105;output.at:142;Output files: --header=foo.hpp -o foo.c++;; 106;output.at:146;Output files: --header=foo.hpp -o foo.c++;; 107;output.at:150;Output files: %header \"foo.hpp\" -o foo.c++;; 108;output.at:154;Output files: -o foo.c++ --graph=foo.gph;; 109;output.at:160;Output files: %type useless --header --graph --xml --report=all -Wall -Werror;; 110;output.at:167;Output files: useless=--header --graph --xml --report=all -Wall -Werror;; 111;output.at:173;Output files: %defines -o foo.c++;; 112;output.at:176;Output files: %defines \"foo.hpp\" -o foo.c++;; 113;output.at:191;Output files: lalr1.cc ;; 114;output.at:194;Output files: lalr1.cc %verbose ;; 115;output.at:197;Output files: lalr1.cc %header %verbose ;; 116;output.at:200;Output files: lalr1.cc %verbose %locations ;; 117;output.at:203;Output files: lalr1.cc %header %verbose %locations ;; 118;output.at:206;Output files: lalr1.cc %header %verbose ;; 119;output.at:210;Output files: lalr1.cc %header %verbose %locations -o subdir/foo.cc;; 120;output.at:215;Output files: lalr1.cc %header %verbose %file-prefix \"output_dir/foo\" ;; 121;output.at:220;Output files: lalr1.cc %header %locations %verbose %file-prefix \"output_dir/foo\" ;; 122;output.at:226;Output files: lalr1.cc %header %locations api.location.file=none %require \"3.2\" ;; 123;output.at:231;Output files: lalr1.cc %header %locations api.location.file=\"foo.loc.hh\" %require \"3.2\" ;; 124;output.at:237;Output files: lalr1.cc %header %locations api.location.file=\"\$at_dir/foo.loc.hh\" %require \"3.2\" ;; 125;output.at:267;Conflicting output files: --graph=\"foo.tab.c\";; 126;output.at:272;Conflicting output files: %header \"foo.output\" -v;; 127;output.at:277;Conflicting output files: lalr1.cc %header %locations --graph=\"location.hh\";; 128;output.at:282;Conflicting output files: -o foo.y;; 129;output.at:328;Output file name: \`~!@#\$%^&*()-=_+{}[]|\\:;<>, .';c++; 130;output.at:335;Output file name: (;c++; 131;output.at:336;Output file name: );c++; 132;output.at:337;Output file name: #;c++; 133;output.at:338;Output file name: @@;c++; 134;output.at:339;Output file name: @{;c++; 135;output.at:340;Output file name: @};c++; 136;output.at:341;Output file name: [;c++; 137;output.at:342;Output file name: ];c++; 138;output.at:363;Graph with no conflicts;graph; 139;output.at:403;Graph with unsolved S/R;graph; 140;output.at:473;Graph with solved S/R;graph; 141;output.at:538;Graph with R/R;graph; 142;output.at:576;Graph with reductions with multiple LAT;graph; 143;output.at:641;Graph with a reduction rule both enabled and disabled;graph; 144;output.at:744;C++ Output File Prefix Mapping;c++; 145;diagnostics.at:84;Warnings;diagnostics; 146;diagnostics.at:133;Single point locations;diagnostics; 147;diagnostics.at:182;Line is too short, and then you die;diagnostics; 148;diagnostics.at:217;Zero-width characters;diagnostics; 149;diagnostics.at:235;Tabulations and multibyte characters;diagnostics; 150;diagnostics.at:282;Tabulations and multibyte characters;diagnostics; 151;diagnostics.at:303;Special files;diagnostics; 152;diagnostics.at:328;Complaints from M4;diagnostics; 153;diagnostics.at:351;Carriage return;diagnostics; 154;diagnostics.at:372;CR NL;diagnostics; 155;diagnostics.at:399;Screen width: 200 columns;diagnostics; 156;diagnostics.at:432;Screen width: 80 columns;diagnostics; 157;diagnostics.at:465;Screen width: 60 columns;diagnostics; 158;diagnostics.at:504;Suggestions;diagnostics; 159;diagnostics.at:527;Counterexamples;diagnostics cex; 160;diagnostics.at:645;Deep Counterexamples;diagnostics cex; 161;diagnostics.at:713;Indentation with message suppression;; 162;skeletons.at:25;Relative skeleton file names;; 163;skeletons.at:85;Installed skeleton file names;; 164;skeletons.at:142;Boolean=variables: invalid skeleton defaults;; 165;skeletons.at:166;Complaining during macro argument expansion;; 166;skeletons.at:248;Fatal errors make M4 exit immediately;; 167;skeletons.at:302;Fatal errors but M4 continues producing output;; 168;sets.at:27;Nullable;; 169;sets.at:111;Broken Closure;; 170;sets.at:153;Firsts;; 171;sets.at:228;Accept;; 172;sets.at:269;Build relations;; 173;sets.at:315;Reduced Grammar;; 174;sets.at:394;Reduced Grammar with prec and assoc;; 175;reduce.at:26;Useless Terminals;; 176;reduce.at:70;Useless Nonterminals;; 177;reduce.at:120;Useless Rules;report; 178;reduce.at:224;Useless Parts;; 179;reduce.at:312;Reduced Automaton;report; 180;reduce.at:406;Underivable Rules;report; 181;reduce.at:452;Bad start symbols;multistart; 182;reduce.at:550;no lr.type: Single State Split;; 183;reduce.at:550;lr.type=lalr: Single State Split;; 184;reduce.at:550;lr.type=ielr: Single State Split;; 185;reduce.at:550;lr.type=canonical-lr: Single State Split;; 186;reduce.at:783;no lr.type: Lane Split;; 187;reduce.at:783;lr.type=lalr: Lane Split;; 188;reduce.at:783;lr.type=ielr: Lane Split;; 189;reduce.at:783;lr.type=canonical-lr: Lane Split;; 190;reduce.at:1027;no lr.type: Complex Lane Split;; 191;reduce.at:1027;lr.type=lalr: Complex Lane Split;; 192;reduce.at:1027;lr.type=ielr: Complex Lane Split;; 193;reduce.at:1027;lr.type=canonical-lr: Complex Lane Split;; 194;reduce.at:1296;no lr.type: Split During Added Lookahead Propagation;; 195;reduce.at:1296;lr.type=lalr: Split During Added Lookahead Propagation;; 196;reduce.at:1296;lr.type=ielr: Split During Added Lookahead Propagation;; 197;reduce.at:1296;lr.type=canonical-lr: Split During Added Lookahead Propagation;; 198;reduce.at:1627;no lr.default-reduction;; 199;reduce.at:1627;lr.default-reduction=most;; 200;reduce.at:1627;lr.default-reduction=consistent;; 201;reduce.at:1627;lr.default-reduction=accepting;; 202;report.at:37;Reports;report html; 203;report.at:3123;Reports with conflicts;cex report html; 204;conflicts.at:28;Token declaration order;; 205;conflicts.at:101;Token declaration order: literals vs. identifiers;; 206;conflicts.at:183;Useless associativity warning;; 207;conflicts.at:218;Useless precedence warning;; 208;conflicts.at:275;S/R in initial;; 209;conflicts.at:301;%nonassoc and eof;; 210;conflicts.at:509;parse.error=verbose and consistent errors: lr.type=ielr;; 211;conflicts.at:513;parse.error=verbose and consistent errors: lr.type=ielr %glr-parser;glr; 212;conflicts.at:518;parse.error=verbose and consistent errors: lr.type=ielr c++;c++; 213;conflicts.at:523;parse.error=verbose and consistent errors: lr.type=ielr java;java; 214;conflicts.at:530;parse.error=verbose and consistent errors: lr.type=ielr lr.default-reduction=consistent;; 215;conflicts.at:535;parse.error=verbose and consistent errors: lr.type=ielr lr.default-reduction=accepting;; 216;conflicts.at:540;parse.error=verbose and consistent errors: lr.type=canonical-lr;; 217;conflicts.at:546;parse.error=verbose and consistent errors: lr.type=canonical-lr parse.lac=full;; 218;conflicts.at:551;parse.error=verbose and consistent errors: lr.type=ielr parse.lac=full;; 219;conflicts.at:558;parse.error=verbose and consistent errors: c++ lr.type=canonical-lr parse.lac=full;c++; 220;conflicts.at:564;parse.error=verbose and consistent errors: c++ lr.type=ielr parse.lac=full;c++; 221;conflicts.at:622;parse.error=verbose and consistent errors: ;; 222;conflicts.at:626;parse.error=verbose and consistent errors: %glr-parser;glr; 223;conflicts.at:632;parse.error=verbose and consistent errors: lr.default-reduction=consistent;; 224;conflicts.at:638;parse.error=verbose and consistent errors: lr.default-reduction=accepting;; 225;conflicts.at:642;parse.error=verbose and consistent errors: lr.type=canonical-lr;; 226;conflicts.at:647;parse.error=verbose and consistent errors: parse.lac=full;; 227;conflicts.at:651;parse.error=verbose and consistent errors: parse.lac=full lr.default-reduction=accepting;; 228;conflicts.at:676;LAC: %nonassoc requires splitting canonical LR states;; 229;conflicts.at:764;Unresolved SR Conflicts;cex report; 230;conflicts.at:887;Resolved SR Conflicts;report; 231;conflicts.at:989;%precedence suffices;; 232;conflicts.at:1015;%precedence does not suffice;; 233;conflicts.at:1096;Syntax error in consistent error state: yacc.c;; 234;conflicts.at:1096;Syntax error in consistent error state: glr.c;glr; 235;conflicts.at:1096;Syntax error in consistent error state: lalr1.cc;c++; 236;conflicts.at:1096;Syntax error in consistent error state: glr.cc;glr c++; 237;conflicts.at:1096;Syntax error in consistent error state: glr2.cc;glr c++; 238;conflicts.at:1127;Defaulted Conflicted Reduction;cex report; 239;conflicts.at:1264;%expect not enough;; 240;conflicts.at:1284;%expect right;; 241;conflicts.at:1301;%expect too much;; 242;conflicts.at:1321;%expect with reduce conflicts;; 243;conflicts.at:1341;%expect in grammar rule not enough;; 244;conflicts.at:1360;%expect in grammar rule right;; 245;conflicts.at:1377;%expect in grammar rules;; 246;conflicts.at:1396;%expect in grammar rule too much;; 247;conflicts.at:1415;%expect-rr in grammar rule;; 248;conflicts.at:1440;%expect-rr too much in grammar rule;; 249;conflicts.at:1469;%expect-rr not enough in grammar rule;; 250;conflicts.at:1498;%prec with user string;; 251;conflicts.at:1515;%no-default-prec without %prec;; 252;conflicts.at:1544;%no-default-prec with %prec;; 253;conflicts.at:1568;%default-prec;; 254;conflicts.at:1592;Unreachable States After Conflict Resolution;cex report; 255;conflicts.at:1855;Solved conflicts report for multiple reductions in a state;; 256;conflicts.at:1935;%nonassoc error actions for multiple reductions in a state;cex report; 257;conflicts.at:2299;%expect-rr non GLR;; 258;conflicts.at:2331;-W versus %expect and %expect-rr;; 259;counterexample.at:43;Unifying S/R;cex; 260;counterexample.at:83;Deep Unifying S/R;cex; 261;counterexample.at:144;S/R Conflict with Nullable Symbols;cex; 262;counterexample.at:207;Non-unifying Ambiguous S/R;cex; 263;counterexample.at:254;Non-unifying Unambiguous S/R;cex; 264;counterexample.at:298;S/R after first token;cex; 265;counterexample.at:363;Unifying R/R counterexample;cex; 266;counterexample.at:399;Non-unifying R/R LR(1) conflict;cex; 267;counterexample.at:441;Non-unifying R/R LR(2) conflict;cex; 268;counterexample.at:488;Cex Search Prepend;cex; 269;counterexample.at:550;R/R cex with prec;cex; 270;counterexample.at:610;Null nonterminals;cex; 271;counterexample.at:797;Non-unifying Prefix Share;cex; 272;counterexample.at:842;Deep Null Unifying;cex; 273;counterexample.at:884;Deep Null Non-unifying;cex; 274;synclines.at:194;Prologue syncline;; 275;synclines.at:214;%union syncline;; 276;synclines.at:237;%union name syncline;; 277;synclines.at:264;Postprologue syncline;; 278;synclines.at:291;Action syncline;; 279;synclines.at:310;Epilogue syncline;; 280;synclines.at:327;%code top syncline;; 281;synclines.at:346;%destructor syncline;; 282;synclines.at:370;%printer syncline;; 283;synclines.at:440;syncline escapes: yacc.c;; 284;synclines.at:440;syncline escapes: glr.c;glr; 285;synclines.at:440;syncline escapes: lalr1.cc;c++; 286;synclines.at:440;syncline escapes: glr.cc;glr c++; 287;synclines.at:440;syncline escapes: glr2.cc;glr c++; 288;synclines.at:497;%no-lines: yacc.c;; 289;synclines.at:497;%no-lines: glr.c;glr; 290;synclines.at:497;%no-lines: lalr1.cc;; 291;synclines.at:497;%no-lines: glr.cc;glr; 292;synclines.at:497;%no-lines: glr2.cc;glr; 293;synclines.at:507;Output columns;; 294;headers.at:56;Invalid CPP guards: --defines=input/input.h;; 295;headers.at:57;Invalid CPP guards: --defines=9foo.h;; 296;headers.at:58;Invalid CPP guards: %glr-parser --defines=input/input.h;glr; 297;headers.at:59;Invalid CPP guards: %glr-parser --defines=9foo.h;glr; 298;headers.at:67;export YYLTYPE;; 299;headers.at:177;Sane headers: ;; 300;headers.at:178;Sane headers: %locations %debug;; 301;headers.at:180;Sane headers: %glr-parser;glr; 302;headers.at:181;Sane headers: %locations %debug %glr-parser;glr; 303;headers.at:183;Sane headers: api.pure;; 304;headers.at:184;Sane headers: api.push-pull=both;push; 305;headers.at:185;Sane headers: api.pure api.push-pull=both;push; 306;headers.at:187;Sane headers: c++;c++; 307;headers.at:188;Sane headers: %locations %debug c++;c++; 308;headers.at:189;Sane headers: c++ api.value.type=variant parse.assert;c++; 309;headers.at:191;Sane headers: %locations c++ %glr-parser;glr c++; 310;headers.at:199;Several parsers;glr c++ push; 311;actions.at:24;Midrule actions;; 312;actions.at:72;Typed midrule actions;; 313;actions.at:122;Implicitly empty rule;; 314;actions.at:172;Invalid uses of %empty;; 315;actions.at:240;Valid uses of %empty;; 316;actions.at:270;Add missing %empty;; 317;actions.at:365;Initial location: yacc.c ;; 318;actions.at:366;Initial location: yacc.c api.pure=full;; 319;actions.at:367;Initial location: yacc.c api.pure %parse-param { int x };; 320;actions.at:368;Initial location: yacc.c api.push-pull=both;push; 321;actions.at:369;Initial location: yacc.c api.push-pull=both api.pure=full;push; 322;actions.at:370;Initial location: glr.c ;glr; 323;actions.at:371;Initial location: glr.c api.pure;glr; 324;actions.at:372;Initial location: lalr1.cc ;c++; 325;actions.at:373;Initial location: glr.cc ;glr c++; 326;actions.at:374;Initial location: glr2.cc ;glr c++; 327;actions.at:383;Initial location: yacc.c api.pure=full;; 328;actions.at:394;Initial location: yacc.c api.pure=full;; 329;actions.at:478;Location print: yacc.c ;; 330;actions.at:478;Location print: glr.c ;glr; 331;actions.at:478;Location print: lalr1.cc ;c++; 332;actions.at:478;Location print: glr.cc ;glr c++; 333;actions.at:478;Location print: glr2.cc ;glr c++; 334;actions.at:488;Exotic Dollars;; 335;actions.at:1047;Printers and Destructors;; 336;actions.at:1048;Printers and Destructors with union;; 337;actions.at:1050;Printers and Destructors: %glr-parser;glr; 338;actions.at:1051;Printers and Destructors with union: %glr-parser;glr; 339;actions.at:1053;Printers and Destructors: %header lalr1.cc;c++; 340;actions.at:1054;Printers and Destructors with union: %header lalr1.cc;c++; 341;actions.at:1056;Printers and Destructors: %header glr.cc;glr c++; 342;actions.at:1057;Printers and Destructors with union: %header glr.cc;glr c++; 343;actions.at:1059;Printers and Destructors: %header glr2.cc;glr c++; 344;actions.at:1060;Printers and Destructors with union: %header glr2.cc;glr c++; 345;actions.at:1071;Default tagless %printer and %destructor;; 346;actions.at:1174;Default tagged and per-type %printer and %destructor;; 347;actions.at:1307;Default %printer and %destructor for user-defined end token;; 348;actions.at:1429;Default %printer and %destructor are not for error or \$undefined;; 349;actions.at:1532;Default %printer and %destructor are not for \$accept;; 350;actions.at:1596;Default %printer and %destructor for midrule values;; 351;actions.at:1743;@\$ in %initial-action implies %locations;; 352;actions.at:1744;@\$ in %destructor implies %locations;; 353;actions.at:1745;@\$ in %printer implies %locations;; 354;actions.at:1856;Qualified \$\$ in actions: yacc.c;; 355;actions.at:1856;Qualified \$\$ in actions: glr.c;glr; 356;actions.at:1856;Qualified \$\$ in actions: lalr1.cc;c++; 357;actions.at:1856;Qualified \$\$ in actions: glr.cc;glr c++; 358;actions.at:1856;Qualified \$\$ in actions: glr2.cc;glr c++; 359;actions.at:1863;Destroying lookahead assigned by semantic action;; 360;actions.at:1918;YYBACKUP;; 361;types.at:25;%union vs. api.value.type;; 362;types.at:44;%yacc vs. api.value.type=union;; 363;types.at:139;yacc.c api.value.type={double};api.value.type; 364;types.at:139;yacc.c api.value.type={double} %header;api.value.type; 365;types.at:139;yacc.c api.value.type={variant};api.value.type; 366;types.at:139;yacc.c api.value.type={variant} %header;api.value.type; 367;types.at:139;yacc.c api.value.type={struct foo};api.value.type; 368;types.at:139;yacc.c api.value.type={struct foo} %header;api.value.type; 369;types.at:139;yacc.c api.value.type={struct bar};api.value.type; 370;types.at:139;yacc.c api.value.type={struct bar} %header;api.value.type; 371;types.at:139;yacc.c api.value.type={union foo};api.value.type; 372;types.at:139;yacc.c api.value.type={union foo} %header;api.value.type; 373;types.at:139;yacc.c %union { float fval; int ival; };;api.value.type; 374;types.at:139;yacc.c %union { float fval; int ival; }; %header;api.value.type; 375;types.at:139;yacc.c %union foo { float fval; int ival; };;api.value.type; 376;types.at:139;yacc.c %union foo { float fval; int ival; }; %header;api.value.type; 377;types.at:139;yacc.c api.value.union.name=foo; %union { float fval; int ival; };;api.value.type; 378;types.at:139;yacc.c api.value.union.name=foo; %union { float fval; int ival; }; %header;api.value.type; 379;types.at:139;yacc.c api.value.type=union;api.value.type; 380;types.at:139;yacc.c api.value.type=union %header;api.value.type; 381;types.at:139;glr.c api.value.type={double};api.value.type glr; 382;types.at:139;glr.c api.value.type={double} %header;api.value.type glr; 383;types.at:139;glr.c api.value.type={variant};api.value.type glr; 384;types.at:139;glr.c api.value.type={variant} %header;api.value.type glr; 385;types.at:139;glr.c api.value.type={struct foo};api.value.type glr; 386;types.at:139;glr.c api.value.type={struct foo} %header;api.value.type glr; 387;types.at:139;glr.c api.value.type={struct bar};api.value.type glr; 388;types.at:139;glr.c api.value.type={struct bar} %header;api.value.type glr; 389;types.at:139;glr.c api.value.type={union foo};api.value.type glr; 390;types.at:139;glr.c api.value.type={union foo} %header;api.value.type glr; 391;types.at:139;glr.c %union { float fval; int ival; };;api.value.type glr; 392;types.at:139;glr.c %union { float fval; int ival; }; %header;api.value.type glr; 393;types.at:139;glr.c %union foo { float fval; int ival; };;api.value.type glr; 394;types.at:139;glr.c %union foo { float fval; int ival; }; %header;api.value.type glr; 395;types.at:139;glr.c api.value.union.name=foo; %union { float fval; int ival; };;api.value.type glr; 396;types.at:139;glr.c api.value.union.name=foo; %union { float fval; int ival; }; %header;api.value.type glr; 397;types.at:139;glr.c api.value.type=union;api.value.type glr; 398;types.at:139;glr.c api.value.type=union %header;api.value.type glr; 399;types.at:139;lalr1.cc api.value.type={double};api.value.type c++; 400;types.at:139;lalr1.cc api.value.type={double} %header;api.value.type c++; 401;types.at:139;lalr1.cc api.value.type={variant};api.value.type c++; 402;types.at:139;lalr1.cc api.value.type={variant} %header;api.value.type c++; 403;types.at:139;lalr1.cc api.value.type={struct foo};api.value.type c++; 404;types.at:139;lalr1.cc api.value.type={struct foo} %header;api.value.type c++; 405;types.at:139;lalr1.cc api.value.type={struct bar};api.value.type c++; 406;types.at:139;lalr1.cc api.value.type={struct bar} %header;api.value.type c++; 407;types.at:139;lalr1.cc api.value.type={union foo};api.value.type c++; 408;types.at:139;lalr1.cc api.value.type={union foo} %header;api.value.type c++; 409;types.at:139;lalr1.cc %union { float fval; int ival; };;api.value.type c++; 410;types.at:139;lalr1.cc %union { float fval; int ival; }; %header;api.value.type c++; 411;types.at:139;lalr1.cc api.value.type=union;api.value.type c++; 412;types.at:139;lalr1.cc api.value.type=union %header;api.value.type c++; 413;types.at:139;lalr1.cc api.value.type=variant;api.value.type c++; 414;types.at:139;lalr1.cc api.value.type=variant %header;api.value.type c++; 415;types.at:139;lalr1.cc api.value.type=variant;api.value.type c++; 416;types.at:139;lalr1.cc api.value.type=variant %header;api.value.type c++; 417;types.at:139;lalr1.cc api.value.type=variant api.token.constructor;api.value.type c++; 418;types.at:139;lalr1.cc api.value.type=variant api.token.constructor %header;api.value.type c++; 419;types.at:139;lalr1.cc %code requires { #include } api.value.type=variant;api.value.type c++; 420;types.at:139;lalr1.cc %code requires { #include } api.value.type=variant %header;api.value.type c++; 421;types.at:139;lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor;api.value.type c++; 422;types.at:139;lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor %header;api.value.type c++; 423;types.at:139;lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor;api.value.type c++; 424;types.at:139;lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor %header;api.value.type c++; 425;types.at:139;glr.cc api.value.type={double};api.value.type glr c++; 426;types.at:139;glr.cc api.value.type={double} %header;api.value.type glr c++; 427;types.at:139;glr.cc api.value.type={variant};api.value.type glr c++; 428;types.at:139;glr.cc api.value.type={variant} %header;api.value.type glr c++; 429;types.at:139;glr.cc api.value.type={struct foo};api.value.type glr c++; 430;types.at:139;glr.cc api.value.type={struct foo} %header;api.value.type glr c++; 431;types.at:139;glr.cc api.value.type={struct bar};api.value.type glr c++; 432;types.at:139;glr.cc api.value.type={struct bar} %header;api.value.type glr c++; 433;types.at:139;glr.cc api.value.type={union foo};api.value.type glr c++; 434;types.at:139;glr.cc api.value.type={union foo} %header;api.value.type glr c++; 435;types.at:139;glr.cc %union { float fval; int ival; };;api.value.type glr c++; 436;types.at:139;glr.cc %union { float fval; int ival; }; %header;api.value.type glr c++; 437;types.at:139;glr.cc api.value.type=union;api.value.type glr c++; 438;types.at:139;glr.cc api.value.type=union %header;api.value.type glr c++; 439;types.at:139;glr2.cc api.value.type={double};api.value.type glr c++; 440;types.at:139;glr2.cc api.value.type={double} %header;api.value.type glr c++; 441;types.at:139;glr2.cc api.value.type={variant};api.value.type glr c++; 442;types.at:139;glr2.cc api.value.type={variant} %header;api.value.type glr c++; 443;types.at:139;glr2.cc api.value.type={struct foo};api.value.type glr c++; 444;types.at:139;glr2.cc api.value.type={struct foo} %header;api.value.type glr c++; 445;types.at:139;glr2.cc api.value.type={struct bar};api.value.type glr c++; 446;types.at:139;glr2.cc api.value.type={struct bar} %header;api.value.type glr c++; 447;types.at:139;glr2.cc api.value.type={union foo};api.value.type glr c++; 448;types.at:139;glr2.cc api.value.type={union foo} %header;api.value.type glr c++; 449;types.at:139;glr2.cc %union { float fval; int ival; };;api.value.type glr c++; 450;types.at:139;glr2.cc %union { float fval; int ival; }; %header;api.value.type glr c++; 451;types.at:139;glr2.cc api.value.type=union;api.value.type glr c++; 452;types.at:139;glr2.cc api.value.type=union %header;api.value.type glr c++; 453;types.at:377;lalr1.cc: Named %union;; 454;types.at:377;glr.cc: Named %union;; 455;scanner.at:326;Token numbers: yacc.c;; 456;scanner.at:326;Token numbers: yacc.c api.token.raw;; 457;scanner.at:326;Token numbers: glr.c;glr; 458;scanner.at:326;Token numbers: glr.c api.token.raw;glr; 459;scanner.at:326;Token numbers: lalr1.cc;c++; 460;scanner.at:326;Token numbers: lalr1.cc api.token.raw;c++; 461;scanner.at:326;Token numbers: glr.cc;glr c++; 462;scanner.at:326;Token numbers: glr.cc api.token.raw;glr c++; 463;scanner.at:326;Token numbers: glr2.cc;glr c++; 464;scanner.at:326;Token numbers: glr2.cc api.token.raw;glr c++; 465;scanner.at:326;Token numbers: lalr1.d;d; 466;scanner.at:326;Token numbers: lalr1.d api.token.raw;d; 467;scanner.at:326;Token numbers: lalr1.java;java; 468;scanner.at:326;Token numbers: lalr1.java api.token.raw;java; 469;scanner.at:330;Token numbers: lalr1.cc api.token.raw api.value.type=variant api.token.constructor;c++; 470;calc.at:1334;Calculator parse.trace ;; 471;calc.at:1336;Calculator %header ;; 472;calc.at:1337;Calculator %debug %locations ;; 473;calc.at:1338;Calculator %locations api.location.type={Span} ;; 474;calc.at:1340;Calculator %name-prefix \"calc\" ;; 475;calc.at:1341;Calculator %verbose ;; 476;calc.at:1342;Calculator %yacc ;yacc; 477;calc.at:1343;Calculator parse.error=detailed ;; 478;calc.at:1344;Calculator parse.error=verbose ;; 479;calc.at:1346;Calculator api.pure=full %locations ;; 480;calc.at:1347;Calculator api.push-pull=both api.pure=full %locations ;push; 481;calc.at:1348;Calculator parse.error=detailed %locations ;; 482;calc.at:1350;Calculator parse.error=detailed %locations %header api.prefix={calc} %verbose %yacc ;yacc; 483;calc.at:1351;Calculator parse.error=detailed %locations %header %name-prefix \"calc\" api.token.prefix={TOK_} %verbose %yacc ;yacc; 484;calc.at:1353;Calculator %debug ;; 485;calc.at:1354;Calculator parse.error=detailed %debug %locations %header %name-prefix \"calc\" %verbose %yacc ;yacc; 486;calc.at:1355;Calculator parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc ;yacc; 487;calc.at:1357;Calculator api.pure=full parse.error=detailed %debug %locations %header %name-prefix \"calc\" %verbose %yacc ;yacc; 488;calc.at:1358;Calculator api.push-pull=both api.pure=full parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc ;push yacc; 489;calc.at:1360;Calculator api.pure parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} ;yacc; 490;calc.at:1362;Calculator %no-lines api.pure parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} ;yacc; 491;calc.at:1363;Calculator %no-lines api.pure parse.error=verbose %debug %locations %header api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} ;yacc; 492;calc.at:1364;Calculator %no-lines api.pure parse.error=verbose %debug %locations %defines api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} ;yacc; 493;calc.at:1367;Calculator parse.error=custom ;; 494;calc.at:1368;Calculator parse.error=custom %locations api.prefix={calc} ;; 495;calc.at:1369;Calculator parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} ;; 496;calc.at:1370;Calculator parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} api.push-pull=both api.pure=full ;push; 497;calc.at:1371;Calculator parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} api.push-pull=both api.pure=full parse.lac=full ;push; 498;calc.at:1374;Calculator %start input exp NUM api.value.type=union ;multistart; 499;calc.at:1375;Calculator %start input exp NUM api.value.type=union %locations parse.error=detailed ;multistart; 500;calc.at:1387;Calculator %glr-parser ;glr; 501;calc.at:1389;Calculator %glr-parser %header ;glr; 502;calc.at:1390;Calculator %glr-parser %locations ;glr; 503;calc.at:1391;Calculator %glr-parser %locations api.location.type={Span} ;glr; 504;calc.at:1392;Calculator %glr-parser %name-prefix \"calc\" ;glr; 505;calc.at:1393;Calculator %glr-parser api.prefix={calc} ;glr; 506;calc.at:1394;Calculator %glr-parser %verbose ;glr; 507;calc.at:1395;Calculator %glr-parser parse.error=verbose ;glr; 508;calc.at:1397;Calculator %glr-parser api.pure %locations ;glr; 509;calc.at:1398;Calculator %glr-parser parse.error=verbose %locations ;glr; 510;calc.at:1400;Calculator %glr-parser parse.error=custom %locations %header %name-prefix \"calc\" %verbose ;glr; 511;calc.at:1401;Calculator %glr-parser parse.error=custom %locations %header %name-prefix \"calc\" %verbose api.pure ;glr; 512;calc.at:1402;Calculator %glr-parser parse.error=detailed %locations %header %name-prefix \"calc\" %verbose ;glr; 513;calc.at:1403;Calculator %glr-parser parse.error=verbose %locations %header %name-prefix \"calc\" %verbose ;glr; 514;calc.at:1405;Calculator %glr-parser parse.error=custom %locations %header %name-prefix \"calc\" %verbose ;glr; 515;calc.at:1407;Calculator %glr-parser %debug ;glr; 516;calc.at:1408;Calculator %glr-parser parse.error=verbose %debug %locations %header %name-prefix \"calc\" %verbose ;glr; 517;calc.at:1409;Calculator %glr-parser parse.error=verbose %debug %locations %header api.prefix={calc} api.token.prefix={TOK_} %verbose ;glr; 518;calc.at:1411;Calculator %glr-parser api.pure parse.error=verbose %debug %locations %header %name-prefix \"calc\" %verbose ;glr; 519;calc.at:1413;Calculator %glr-parser api.pure parse.error=verbose %debug %locations %header %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr; 520;calc.at:1414;Calculator %glr-parser api.pure parse.error=verbose %debug %locations %header api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr; 521;calc.at:1416;Calculator %glr-parser %no-lines api.pure parse.error=verbose %debug %locations %header api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr; 522;calc.at:1426;Calculator lalr1.cc %header ;c++; 523;calc.at:1431;Calculator C++ ;c++; 524;calc.at:1432;Calculator C++ %locations ;c++; 525;calc.at:1433;Calculator C++ %locations \$NO_EXCEPTIONS_CXXFLAGS;c++; 526;calc.at:1434;Calculator C++ %locations api.location.type={Span} ;c++; 527;calc.at:1435;Calculator C++ %header %locations parse.error=verbose %name-prefix \"calc\" %verbose ;c++; 528;calc.at:1437;Calculator C++ %locations parse.error=verbose api.prefix={calc} %verbose ;c++; 529;calc.at:1438;Calculator C++ %locations parse.error=verbose %debug %name-prefix \"calc\" %verbose ;c++; 530;calc.at:1440;Calculator C++ %locations parse.error=verbose %debug api.prefix={calc} %verbose ;c++; 531;calc.at:1441;Calculator C++ %locations parse.error=verbose %debug api.prefix={calc} api.token.prefix={TOK_} %verbose ;c++; 532;calc.at:1443;Calculator C++ %header %locations parse.error=verbose %debug %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;c++; 533;calc.at:1445;Calculator C++ parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;c++; 534;calc.at:1446;Calculator C++ %header %locations parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;c++; 535;calc.at:1448;Calculator C++ %header %locations api.location.file=none ;c++; 536;calc.at:1449;Calculator C++ %header %locations api.location.file=\"my-location.hh\" ;c++; 537;calc.at:1451;Calculator C++ %no-lines %header %locations api.location.file=\"my-location.hh\" ;c++; 538;calc.at:1453;Calculator C++ %locations parse.lac=full parse.error=verbose ;c++; 539;calc.at:1454;Calculator C++ %locations parse.lac=full parse.error=detailed ;c++; 540;calc.at:1455;Calculator C++ %locations parse.lac=full parse.error=detailed parse.trace ;c++; 541;calc.at:1457;Calculator C++ parse.error=custom ;c++; 542;calc.at:1458;Calculator C++ parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} ;c++; 543;calc.at:1459;Calculator C++ parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} parse.lac=full ;c++; 544;calc.at:1468;Calculator glr.cc ;glr c++; 545;calc.at:1469;Calculator glr2.cc ;glr c++; 546;calc.at:1476;Calculator C++ %glr-parser ;glr c++; 547;calc.at:1476;Calculator glr2.cc ;glr c++; 548;calc.at:1477;Calculator C++ %glr-parser %locations ;glr c++; 549;calc.at:1477;Calculator glr2.cc %locations ;glr c++; 550;calc.at:1478;Calculator C++ %glr-parser %locations api.location.type={Span} ;glr c++; 551;calc.at:1478;Calculator glr2.cc %locations api.location.type={Span} ;glr c++; 552;calc.at:1479;Calculator C++ %glr-parser %header parse.error=verbose %name-prefix \"calc\" %verbose ;glr c++; 553;calc.at:1479;Calculator glr2.cc %header parse.error=verbose %name-prefix \"calc\" %verbose ;glr c++; 554;calc.at:1480;Calculator C++ %glr-parser parse.error=verbose api.prefix={calc} %verbose ;glr c++; 555;calc.at:1480;Calculator glr2.cc parse.error=verbose api.prefix={calc} %verbose ;glr c++; 556;calc.at:1482;Calculator C++ %glr-parser %debug ;glr c++; 557;calc.at:1482;Calculator glr2.cc %debug ;glr c++; 558;calc.at:1485;Calculator C++ %glr-parser parse.error=detailed %debug %name-prefix \"calc\" %verbose ;glr c++; 559;calc.at:1485;Calculator glr2.cc parse.error=detailed %debug %name-prefix \"calc\" %verbose ;glr c++; 560;calc.at:1486;Calculator C++ %glr-parser parse.error=verbose %debug %name-prefix \"calc\" %verbose ;glr c++; 561;calc.at:1486;Calculator glr2.cc parse.error=verbose %debug %name-prefix \"calc\" %verbose ;glr c++; 562;calc.at:1487;Calculator glr2.cc parse.error=custom %debug %name-prefix \"calc\" %verbose ;glr c++; 563;calc.at:1489;Calculator C++ %glr-parser parse.error=verbose %debug %name-prefix \"calc\" api.token.prefix={TOK_} %verbose ;glr c++; 564;calc.at:1489;Calculator glr2.cc parse.error=verbose %debug %name-prefix \"calc\" api.token.prefix={TOK_} %verbose ;glr c++; 565;calc.at:1491;Calculator C++ %glr-parser %locations %header parse.error=verbose %debug %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr c++; 566;calc.at:1491;Calculator glr2.cc %locations %header parse.error=verbose %debug %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr c++; 567;calc.at:1492;Calculator C++ %glr-parser %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr c++; 568;calc.at:1492;Calculator glr2.cc %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr c++; 569;calc.at:1494;Calculator C++ %glr-parser %no-lines %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr c++; 570;calc.at:1494;Calculator glr2.cc %no-lines %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} ;glr c++; 571;calc.at:1504;Calculator lalr1.d ;d; 572;calc.at:1509;Calculator D ;d; 573;calc.at:1510;Calculator D %locations ;d; 574;calc.at:1512;Calculator D parse.error=detailed api.prefix={calc} %verbose ;d; 575;calc.at:1514;Calculator D %debug ;d; 576;calc.at:1516;Calculator D parse.error=custom ;d; 577;calc.at:1517;Calculator D %locations parse.error=custom ;d; 578;calc.at:1518;Calculator D %locations parse.error=detailed ;d; 579;calc.at:1519;Calculator D %locations parse.error=simple ;d; 580;calc.at:1520;Calculator D parse.error=detailed %debug %verbose ;d; 581;calc.at:1521;Calculator D parse.error=detailed %debug api.symbol.prefix={SYMB_} api.token.prefix={TOK_} %verbose ;d; 582;calc.at:1523;Calculator D %locations parse.lac=full parse.error=detailed ;d; 583;calc.at:1524;Calculator D %locations parse.lac=full parse.error=custom ;d; 584;calc.at:1525;Calculator D %locations parse.lac=full parse.error=detailed parse.trace ;d; 585;calc.at:1530;Calculator D api.token.constructor %locations parse.error=custom api.value.type=union ;d; 586;calc.at:1531;Calculator D api.token.constructor %locations parse.error=detailed ;d; 587;calc.at:1532;Calculator D api.push-pull=both ;push d; 588;calc.at:1533;Calculator D parse.trace parse.error=custom %locations api.push-pull=both parse.lac=full ;push d; 589;calc.at:1544;Calculator Java ;java; 590;calc.at:1545;Calculator Java parse.error=custom ;java; 591;calc.at:1546;Calculator Java parse.error=detailed ;java; 592;calc.at:1547;Calculator Java parse.error=verbose ;java; 593;calc.at:1548;Calculator Java %locations parse.error=custom ;java; 594;calc.at:1549;Calculator Java %locations parse.error=detailed ;java; 595;calc.at:1550;Calculator Java %locations parse.error=verbose ;java; 596;calc.at:1551;Calculator Java parse.trace parse.error=verbose ;java; 597;calc.at:1552;Calculator Java parse.trace parse.error=verbose %locations %lex-param {InputStream is} ;java; 598;calc.at:1554;Calculator Java api.push-pull=both ;push java; 599;calc.at:1555;Calculator Java api.push-pull=both parse.error=detailed %locations ;push java; 600;calc.at:1556;Calculator Java parse.trace parse.error=custom %locations %lex-param {InputStream is} api.push-pull=both ;push java; 601;calc.at:1557;Calculator Java parse.trace parse.error=verbose %locations %lex-param {InputStream is} api.push-pull=both ;push java; 602;calc.at:1560;Calculator Java parse.trace parse.error=custom %locations parse.lac=full ;java; 603;calc.at:1561;Calculator Java parse.trace parse.error=custom %locations api.push-pull=both parse.lac=full ;push java; 604;torture.at:132;Big triangle;; 605;torture.at:216;Big horizontal;; 606;torture.at:270;State number type: 128 states;; 607;torture.at:271;State number type: 129 states;; 608;torture.at:272;State number type: 256 states;; 609;torture.at:273;State number type: 257 states;; 610;torture.at:274;State number type: 32768 states;; 611;torture.at:275;State number type: 65536 states;; 612;torture.at:276;State number type: 65537 states;; 613;torture.at:385;Many lookahead tokens;; 614;torture.at:485;Exploding the Stack Size with Alloca;push; 615;torture.at:531;Exploding the Stack Size with Malloc;push; 616;existing.at:74;GNU AWK 3.1.0 Grammar: LALR(1);; 617;existing.at:74;GNU AWK 3.1.0 Grammar: IELR(1);; 618;existing.at:74;GNU AWK 3.1.0 Grammar: Canonical LR(1);; 619;existing.at:808;GNU Cim Grammar: LALR(1);; 620;existing.at:808;GNU Cim Grammar: IELR(1);; 621;existing.at:808;GNU Cim Grammar: Canonical LR(1);; 622;existing.at:1460;GNU pic (Groff 1.18.1) Grammar: LALR(1);; 623;existing.at:1460;GNU pic (Groff 1.18.1) Grammar: IELR(1);; 624;existing.at:1460;GNU pic (Groff 1.18.1) Grammar: Canonical LR(1);; 625;regression.at:25;Trivial grammars;; 626;regression.at:55;YYSTYPE typedef;; 627;regression.at:85;Early token definitions with --yacc;yacc; 628;regression.at:127;Early token definitions without --yacc;; 629;regression.at:173;Braces parsing;; 630;regression.at:196;Rule Line Numbers;report; 631;regression.at:345;Mixing %token styles;; 632;regression.at:437;Token definitions: parse.error=detailed;; 633;regression.at:438;Token definitions: parse.error=verbose;; 634;regression.at:447;Characters Escapes;; 635;regression.at:480;Web2c Report;report; 636;regression.at:661;Web2c Actions;report; 637;regression.at:812;Useless Tokens;; 638;regression.at:1143;Dancer ;; 639;regression.at:1144;Dancer %glr-parser;glr; 640;regression.at:1145;Dancer lalr1.cc;c++; 641;regression.at:1220;Expecting two tokens ;; 642;regression.at:1221;Expecting two tokens %glr-parser;glr; 643;regression.at:1222;Expecting two tokens lalr1.cc;c++; 644;regression.at:1230;Braced code in declaration in rules section;; 645;regression.at:1291;String alias declared after use;; 646;regression.at:1314;Extra lookahead sets in report;; 647;regression.at:1355;Token number in precedence declaration;; 648;regression.at:1408;parse-gram.y: LALR = IELR;; 649;regression.at:1430;parse.error=verbose and YYSTACK_USE_ALLOCA;; 650;regression.at:1504;parse.error=verbose overflow;; 651;regression.at:1628;LAC: Exploratory stack;lac push c++ java; 652;regression.at:1739;LAC: Memory exhaustion;lac; 653;regression.at:1874;Lex and parse params: yacc.c;; 654;regression.at:1875;Lex and parse params: glr.c;glr; 655;regression.at:1876;Lex and parse params: lalr1.cc;c++; 656;regression.at:1877;Lex and parse params: glr.cc;glr c++; 657;regression.at:1878;Lex and parse params: glr2.cc;glr c++; 658;regression.at:1889;stdio.h is not needed;; 659;push.at:25;Memory Leak for Early Deletion;; 660;push.at:84;Multiple impure instances;; 661;push.at:145;Unsupported Skeletons;; 662;push.at:167;Pstate reuse;; 663;c++.at:26;C++ Locations Unit Tests;c++; 664;c++.at:107;C++ Variant-based Symbols Unit Tests;variant c++; 665;c++.at:247;Multiple occurrences of \$n and api.value.automove;; 666;c++.at:566;Variants lalr1.cc;variant c++; 667;c++.at:567;Variants lalr1.cc parse.assert;variant c++; 668;c++.at:568;Variants lalr1.cc parse.assert api.value.automove;variant c++; 669;c++.at:569;Variants lalr1.cc parse.assert %locations;variant c++; 670;c++.at:570;Variants lalr1.cc parse.assert %code {\\n#define TWO_STAGE_BUILD\\n};variant c++; 671;c++.at:571;Variants lalr1.cc parse.assert api.token.constructor;variant c++; 672;c++.at:572;Variants lalr1.cc parse.assert api.token.constructor api.token.prefix={TOK_};variant c++; 673;c++.at:573;Variants lalr1.cc parse.assert api.token.constructor api.token.prefix={TOK_} %locations;variant c++; 674;c++.at:574;Variants lalr1.cc parse.assert api.token.constructor api.token.prefix={TOK_} %locations api.value.automove;variant c++; 675;c++.at:584;Variants and Typed Midrule Actions;c++; 676;c++.at:794;Doxygen Public Documentation;; 677;c++.at:795;Doxygen Private Documentation;; 678;c++.at:848;Relative namespace references;c++; 679;c++.at:854;Absolute namespace references;c++; 680;c++.at:863;Syntactically invalid namespace references;; 681;c++.at:884;Syntax error discarding no lookahead;c++; 682;c++.at:1064;Syntax error as exception: lalr1.cc;c++; 683;c++.at:1065;Syntax error as exception: glr.cc;glr c++; 684;c++.at:1066;Syntax error as exception: glr2.cc;glr c++; 685;c++.at:1360;Exception safety with error recovery ;c++; 686;c++.at:1361;Exception safety without error recovery ;c++; 687;c++.at:1362;Exception safety with error recovery api.value.type=variant;c++; 688;c++.at:1363;Exception safety without error recovery api.value.type=variant;c++; 689;c++.at:1371;C++ GLR parser identifier shadowing;glr c++; 690;c++.at:1422;Shared locations;c++; 691;c++.at:1517;Default action;action c++; 692;java.at:25;Java invalid directives;; 693;java.at:186;Java parser class and package names;java; 694;java.at:217;Java parser class modifiers;java; 695;java.at:287;Java parser class extends and implements;java; 696;java.at:307;Java %parse-param and %lex-param;java; 697;java.at:381;Java throws specifications;java; 698;java.at:470;Java constructor init and init_throws;java; 699;java.at:497;Java value, position, and location types;java; 700;java.at:528;Java syntax error handling without error token;java; 701;javapush.at:172;Trivial Push Parser with api.push-pull verification;java; 702;javapush.at:217;Trivial Push Parser with %initial-action;java; 703;d.at:103;D parser class extends and implements;d; 704;d.at:138;D parser class api.token.raw true by default;d; 705;cxx-type.at:409;GLR: Resolve ambiguity, impure, no locations;glr; 706;cxx-type.at:415;GLR: Resolve ambiguity, impure, locations;glr; 707;cxx-type.at:420;GLR: Resolve ambiguity, pure, no locations;glr; 708;cxx-type.at:426;GLR: Resolve ambiguity, pure, locations;glr; 709;cxx-type.at:432;GLR: Merge conflicting parses, impure, no locations;glr; 710;cxx-type.at:438;GLR: Merge conflicting parses, impure, locations;glr; 711;cxx-type.at:444;GLR: Merge conflicting parses, pure, no locations;glr; 712;cxx-type.at:449;GLR: Merge conflicting parses, pure, locations;glr; 713;cxx-type.at:455;GLR: Verbose messages, resolve ambiguity, impure, no locations;glr; 714;glr-regression.at:205;Badly Collapsed GLR States: glr.c;glr %merge; 715;glr-regression.at:206;Badly Collapsed GLR States: glr.cc;glr %merge c++; 716;glr-regression.at:207;Badly Collapsed GLR States: glr2.cc;glr %merge c++; 717;glr-regression.at:354;Improper handling of embedded actions and dollar(-N) in GLR parsers: glr.c;glr; 718;glr-regression.at:355;Improper handling of embedded actions and dollar(-N) in GLR parsers: glr.cc;glr c++; 719;glr-regression.at:356;Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc;glr c++; 720;glr-regression.at:488;Improper merging of GLR delayed action sets: glr.c;%merge glr; 721;glr-regression.at:489;Improper merging of GLR delayed action sets: glr.cc;%merge glr c++; 722;glr-regression.at:490;Improper merging of GLR delayed action sets: glr2.cc;%merge glr c++; 723;glr-regression.at:592;Duplicate representation of merged trees: %union { char *ptr; } glr.c;%merge glr; 724;glr-regression.at:593;Duplicate representation of merged trees: %union { char *ptr; } glr.cc;%merge glr c++; 725;glr-regression.at:594;Duplicate representation of merged trees: %union { char *ptr; } glr2.cc;%merge glr c++; 726;glr-regression.at:596;Duplicate representation of merged trees: api.value.type=union glr.c;%merge glr; 727;glr-regression.at:597;Duplicate representation of merged trees: api.value.type=union glr.cc;%merge glr c++; 728;glr-regression.at:598;Duplicate representation of merged trees: api.value.type=union glr2.cc;%merge glr c++; 729;glr-regression.at:670;User destructor for unresolved GLR semantic value: glr.c;glr; 730;glr-regression.at:671;User destructor for unresolved GLR semantic value: glr.cc;glr c++; 731;glr-regression.at:672;User destructor for unresolved GLR semantic value: glr2.cc;glr c++; 732;glr-regression.at:738;User destructor after an error during a split parse: glr.c;glr; 733;glr-regression.at:739;User destructor after an error during a split parse: glr.cc;glr c++; 734;glr-regression.at:740;User destructor after an error during a split parse: glr2.cc;glr c++; 735;glr-regression.at:843;Duplicated user destructor for lookahead: glr.c;glr; 736;glr-regression.at:844;Duplicated user destructor for lookahead: glr.cc;glr c++; 737;glr-regression.at:845;Duplicated user destructor for lookahead: glr2.cc;glr c++; 738;glr-regression.at:944;Incorrectly initialized location for empty right-hand side in GLR: glr.c;glr; 739;glr-regression.at:945;Incorrectly initialized location for empty right-hand side in GLR: glr.cc;glr c++; 740;glr-regression.at:946;Incorrectly initialized location for empty right-hand side in GLR: glr2.cc;glr c++; 741;glr-regression.at:1036;No users destructors if stack 0 deleted: glr.c;glr; 742;glr-regression.at:1037;No users destructors if stack 0 deleted: glr.cc;glr c++; 743;glr-regression.at:1038;No users destructors if stack 0 deleted: glr2.cc;glr c++; 744;glr-regression.at:1102;Corrupted semantic options if user action cuts parse: glr.c;glr; 745;glr-regression.at:1103;Corrupted semantic options if user action cuts parse: glr.cc;glr c++; 746;glr-regression.at:1104;Corrupted semantic options if user action cuts parse: glr2.cc;glr c++; 747;glr-regression.at:1174;Undesirable destructors if user action cuts parse: glr.c;glr; 748;glr-regression.at:1175;Undesirable destructors if user action cuts parse: glr.cc;glr c++; 749;glr-regression.at:1176;Undesirable destructors if user action cuts parse: glr2.cc;glr c++; 750;glr-regression.at:1310;Leaked semantic values if user action cuts parse: glr.c;%merge glr; 751;glr-regression.at:1311;Leaked semantic values if user action cuts parse: glr.cc;%merge glr c++; 752;glr-regression.at:1312;Leaked semantic values if user action cuts parse: glr2.cc;%merge glr c++; 753;glr-regression.at:1445;Incorrect lookahead during deterministic GLR: glr.c;glr; 754;glr-regression.at:1446;Incorrect lookahead during deterministic GLR: glr.cc;glr c++; 755;glr-regression.at:1447;Incorrect lookahead during deterministic GLR: glr2.cc;glr c++; 756;glr-regression.at:1678;Incorrect lookahead during nondeterministic GLR: glr.c;%merge glr; 757;glr-regression.at:1679;Incorrect lookahead during nondeterministic GLR: glr.cc;%merge glr c++; 758;glr-regression.at:1680;Incorrect lookahead during nondeterministic GLR: glr2.cc;%merge glr c++; 759;glr-regression.at:1785;Leaked semantic values when reporting ambiguity: glr.c;glr; 760;glr-regression.at:1786;Leaked semantic values when reporting ambiguity: glr.cc;glr c++; 761;glr-regression.at:1787;Leaked semantic values when reporting ambiguity: glr2.cc;glr c++; 762;glr-regression.at:1860;Leaked lookahead after nondeterministic parse syntax error: glr.c;glr; 763;glr-regression.at:1861;Leaked lookahead after nondeterministic parse syntax error: glr.cc;glr c++; 764;glr-regression.at:1862;Leaked lookahead after nondeterministic parse syntax error: glr2.cc;glr c++; 765;glr-regression.at:1964;Uninitialized location when reporting ambiguity: glr.c api.pure;glr; 766;glr-regression.at:1965;Uninitialized location when reporting ambiguity: glr.cc;glr c++; 767;glr-regression.at:1966;Uninitialized location when reporting ambiguity: glr2.cc;glr c++; 768;glr-regression.at:2035;Missed %merge type warnings when LHS type is declared later: glr.c;%merge glr; 769;glr-regression.at:2036;Missed %merge type warnings when LHS type is declared later: glr.cc;%merge glr; 770;glr-regression.at:2037;Missed %merge type warnings when LHS type is declared later: glr2.cc;%merge glr; 771;glr-regression.at:2149;Ambiguity reports: glr.c;glr; 772;glr-regression.at:2150;Ambiguity reports: glr.cc;glr c++; 773;glr-regression.at:2151;Ambiguity reports: glr2.cc;glr c++; 774;glr-regression.at:2229;Predicates: glr.c;glr; 775;glr-regression.at:2230;Predicates: glr.cc;glr c++; 776;glr-regression.at:2231;Predicates: glr2.cc;glr c++; " # List of the all the test groups. at_groups_all=`printf "%s\n" "$at_help_all" | sed 's/;.*//'` # at_fn_validate_ranges NAME... # ----------------------------- # Validate and normalize the test group number contained in each variable # NAME. Leading zeroes are treated as decimal. at_fn_validate_ranges () { for at_grp do eval at_value=\$$at_grp if test $at_value -lt 1 || test $at_value -gt 776; then printf "%s\n" "invalid test group: $at_value" >&2 exit 1 fi case $at_value in 0*) # We want to treat leading 0 as decimal, like expr and test, but # AS_VAR_ARITH treats it as octal if it uses $(( )). # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the # expr fork, but it is not worth the effort to determine if the # shell supports XSI when the user can just avoid leading 0. eval $at_grp='`expr $at_value + 0`' ;; esac done } # List of the tested programs. at_tested='"bison"' ## ## Set up package specific options. ## at_arg_compile_c_with_cxx=false at_arg_given_compile_c_with_cxx=false at_prev= for at_option do # If the previous option needs an argument, assign it. if test -n "$at_prev"; then at_option=$at_prev=$at_option at_prev= fi case $at_option in *=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;; *) at_optarg= ;; esac case $at_option in --help | -h ) at_help_p=: ;; --list | -l ) at_list_p=: ;; --version | -V ) at_version_p=: ;; --clean | -c ) at_clean=: ;; --color ) at_color=always ;; --color=* ) case $at_optarg in no | never | none) at_color=never ;; auto | tty | if-tty) at_color=auto ;; always | yes | force) at_color=always ;; *) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'` as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;; esac ;; --debug | -d ) at_debug_p=: ;; --errexit | -e ) at_debug_p=: at_errexit_p=: ;; --verbose | -v ) at_verbose=; at_quiet=: ;; --trace | -x ) at_traceon='set -x' at_trace_echo=echo at_check_filter_trace=at_fn_filter_trace ;; [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]) at_fn_validate_ranges at_option as_fn_append at_groups "$at_option$as_nl" ;; # Ranges [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-) at_range_start=`echo $at_option |tr -d X-` at_fn_validate_ranges at_range_start at_range=`printf "%s\n" "$at_groups_all" | \ sed -ne '/^'$at_range_start'$/,$p'` as_fn_append at_groups "$at_range$as_nl" ;; -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]) at_range_end=`echo $at_option |tr -d X-` at_fn_validate_ranges at_range_end at_range=`printf "%s\n" "$at_groups_all" | \ sed -ne '1,/^'$at_range_end'$/p'` as_fn_append at_groups "$at_range$as_nl" ;; [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \ [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \ [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \ [0-9][0-9][0-9]-[0-9][0-9][0-9] | \ [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \ [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] ) at_range_start=`expr $at_option : '\(.*\)-'` at_range_end=`expr $at_option : '.*-\(.*\)'` if test $at_range_start -gt $at_range_end; then at_tmp=$at_range_end at_range_end=$at_range_start at_range_start=$at_tmp fi at_fn_validate_ranges at_range_start at_range_end at_range=`printf "%s\n" "$at_groups_all" | \ sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'` as_fn_append at_groups "$at_range$as_nl" ;; # Directory selection. --directory | -C ) at_prev=--directory ;; --directory=* ) at_change_dir=: at_dir=$at_optarg if test x- = "x$at_dir" ; then at_dir=./- fi ;; # Parallel execution. --jobs | -j ) at_jobs=0 ;; --jobs=* | -j[0-9]* ) if test -n "$at_optarg"; then at_jobs=$at_optarg else at_jobs=`expr X$at_option : 'X-j\(.*\)'` fi case $at_jobs in *[!0-9]*) at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'` as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;; esac ;; # Keywords. --keywords | -k ) at_prev=--keywords ;; --keywords=* ) at_groups_selected=$at_help_all at_save_IFS=$IFS IFS=, set X $at_optarg shift IFS=$at_save_IFS for at_keyword do at_invert= case $at_keyword in '!'*) at_invert="-v" at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'` ;; esac # It is on purpose that we match the test group titles too. at_groups_selected=`printf "%s\n" "$at_groups_selected" | grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"` done # Smash the keywords. at_groups_selected=`printf "%s\n" "$at_groups_selected" | sed 's/;.*//'` as_fn_append at_groups "$at_groups_selected$as_nl" ;; --recheck) at_recheck=: ;; --compile-c-with-cxx ) at_optarg=: at_arg_compile_c_with_cxx=: at_arg_given_compile_c_with_cxx=: ;; --no-compile-c-with-cxx ) at_optarg=false at_arg_compile_c_with_cxx=false at_arg_given_compile_c_with_cxx=: ;; *=*) at_envvar=`expr "x$at_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $at_envvar in '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$at_envvar'" ;; esac at_value=`printf "%s\n" "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` # Export now, but save eval for later and for debug scripts. export $at_envvar as_fn_append at_debug_args " $at_envvar='$at_value'" ;; *) printf "%s\n" "$as_me: invalid option: $at_option" >&2 printf "%s\n" "Try \`$0 --help' for more information." >&2 exit 1 ;; esac done # Verify our last option didn't require an argument if test -n "$at_prev" then : as_fn_error $? "\`$at_prev' requires an argument" fi # The file containing the suite. at_suite_log=$at_dir/$as_me.log # Selected test groups. if test -z "$at_groups$at_recheck"; then at_groups=$at_groups_all else if test -n "$at_recheck" && test -r "$at_suite_log"; then at_oldfails=`sed -n ' /^Failed tests:$/,/^Skipped tests:$/{ s/^[ ]*\([1-9][0-9]*\):.*/\1/p } /^Unexpected passes:$/,/^## Detailed failed tests/{ s/^[ ]*\([1-9][0-9]*\):.*/\1/p } /^## Detailed failed tests/q ' "$at_suite_log"` as_fn_append at_groups "$at_oldfails$as_nl" fi # Sort the tests, removing duplicates. at_groups=`printf "%s\n" "$at_groups" | sort -nu | sed '/^$/d'` fi if test x"$at_color" = xalways \ || { test x"$at_color" = xauto && test -t 1; }; then at_red=`printf '\033[0;31m'` at_grn=`printf '\033[0;32m'` at_lgn=`printf '\033[1;32m'` at_blu=`printf '\033[1;34m'` at_std=`printf '\033[m'` else at_red= at_grn= at_lgn= at_blu= at_std= fi # Help message. if $at_help_p; then cat <<_ATEOF || at_write_fail=1 Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS] Run all the tests, or the selected TESTS, given by numeric ranges, and save a detailed log file. Upon failure, create debugging scripts. Do not change environment variables directly. Instead, set them via command line arguments. Set \`AUTOTEST_PATH' to select the executables to exercise. Each relative directory is expanded as build and source directories relative to the top level of this distribution. E.g., from within the build directory /tmp/foo-1.0, invoking this: $ $0 AUTOTEST_PATH=bin is equivalent to the following, assuming the source directory is /src/foo-1.0: PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0 _ATEOF cat <<_ATEOF || at_write_fail=1 Operation modes: -h, --help print the help message, then exit -V, --version print version number, then exit -c, --clean remove all the files this test suite might create and exit -l, --list describes all the tests, or the selected TESTS _ATEOF cat <<_ATEOF || at_write_fail=1 Execution tuning: -C, --directory=DIR change to directory DIR before starting --color[=never|auto|always] disable colored test results, or enable even without terminal -j, --jobs[=N] Allow N jobs at once; infinite jobs with no arg (default 1) -k, --keywords=KEYWORDS select the tests matching all the comma-separated KEYWORDS multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD --recheck select all tests that failed or passed unexpectedly last time -e, --errexit abort as soon as a test fails; implies --debug -v, --verbose force more detailed output default for debugging scripts -d, --debug inhibit clean up and top-level logging default for debugging scripts -x, --trace enable tests shell tracing _ATEOF cat <<_ATEOF || at_write_fail=1 Other options: _ATEOF cat <<_ATEOF || at_write_fail=1 compile C parsers with the C++ compiler _ATEOF cat <<_ATEOF || at_write_fail=1 Report bugs to . General help using GNU software: . _ATEOF exit $at_write_fail fi # List of tests. if $at_list_p; then cat <<_ATEOF || at_write_fail=1 GNU Bison 3.8.2 test suite test groups: NUM: FILE-NAME:LINE TEST-GROUP-NAME KEYWORDS _ATEOF # Pass an empty line as separator between selected groups and help. printf "%s\n" "$at_groups$as_nl$as_nl$at_help_all" | awk 'NF == 1 && FS != ";" { selected[$ 1] = 1 next } /^$/ { FS = ";" } NF > 0 { if (selected[$ 1]) { printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3 if ($ 4) { lmax = 79 indent = " " line = indent len = length (line) n = split ($ 4, a, " ") for (i = 1; i <= n; i++) { l = length (a[i]) + 1 if (i > 1 && len + l > lmax) { print line line = indent " " a[i] len = length (line) } else { line = line " " a[i] len += l } } if (n) print line } } }' || at_write_fail=1 exit $at_write_fail fi if $at_version_p; then printf "%s\n" "$as_me (GNU Bison 3.8.2)" && cat <<\_ATEOF || at_write_fail=1 Copyright (C) 2021 Free Software Foundation, Inc. This test suite is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ATEOF exit $at_write_fail fi # Should we print banners? Yes if more than one test is run. case $at_groups in #( *$as_nl* ) at_print_banners=: ;; #( * ) at_print_banners=false ;; esac # Text for banner N, set to a single space once printed. # Banner 1. m4.at:18 # Category starts at test group 1. at_banner_text_1="M4 Macros." # Banner 2. input.at:18 # Category starts at test group 2. at_banner_text_2="Input Processing." # Banner 3. named-refs.at:19 # Category starts at test group 71. at_banner_text_3="Named references tests." # Banner 4. output.at:19 # Category starts at test group 83. at_banner_text_4="Output file names." # Banner 5. diagnostics.at:18 # Category starts at test group 145. at_banner_text_5="Diagnostics." # Banner 6. skeletons.at:19 # Category starts at test group 162. at_banner_text_6="Skeleton Support." # Banner 7. sets.at:20 # Category starts at test group 168. at_banner_text_7="Grammar Sets (Firsts etc.)." # Banner 8. reduce.at:19 # Category starts at test group 175. at_banner_text_8="Grammar Reduction." # Banner 9. report.at:18 # Category starts at test group 202. at_banner_text_9="Test reports." # Banner 10. conflicts.at:19 # Category starts at test group 204. at_banner_text_10="Conflicts." # Banner 11. counterexample.at:18 # Category starts at test group 259. at_banner_text_11="Counterexamples." # Banner 12. synclines.at:19 # Category starts at test group 274. at_banner_text_12="Sync Lines." # Banner 13. headers.at:19 # Category starts at test group 294. at_banner_text_13="Parser Headers." # Banner 14. actions.at:18 # Category starts at test group 311. at_banner_text_14="User Actions." # Banner 15. types.at:18 # Category starts at test group 361. at_banner_text_15="Value type tests." # Banner 16. scanner.at:18 # Category starts at test group 455. at_banner_text_16="Interface with the scanner." # Banner 17. calc.at:1325 # Category starts at test group 470. at_banner_text_17="LALR(1) Calculator." # Banner 18. calc.at:1382 # Category starts at test group 500. at_banner_text_18="GLR Calculator." # Banner 19. calc.at:1423 # Category starts at test group 522. at_banner_text_19="LALR(1) C++ Calculator." # Banner 20. calc.at:1465 # Category starts at test group 544. at_banner_text_20="GLR C++ Calculator." # Banner 21. calc.at:1501 # Category starts at test group 571. at_banner_text_21="LALR(1) D Calculator." # Banner 22. calc.at:1539 # Category starts at test group 589. at_banner_text_22="LALR(1) Java Calculator." # Banner 23. torture.at:19 # Category starts at test group 604. at_banner_text_23="Torture Tests." # Banner 24. existing.at:19 # Category starts at test group 616. at_banner_text_24="Existing Grammars." # Banner 25. regression.at:18 # Category starts at test group 625. at_banner_text_25="Regression tests." # Banner 26. push.at:19 # Category starts at test group 659. at_banner_text_26="Push Parsing Tests" # Banner 27. c++.at:19 # Category starts at test group 663. at_banner_text_27="C++ Features." # Banner 28. java.at:18 # Category starts at test group 692. at_banner_text_28="Java Calculator." # Banner 29. java.at:113 # Category starts at test group 693. at_banner_text_29="Java Parameters." # Banner 30. javapush.at:42 # Category starts at test group 701. at_banner_text_30="Java Push Parsing Tests" # Banner 31. d.at:18 # Category starts at test group 703. at_banner_text_31="D Features." # Banner 32. cxx-type.at:18 # Category starts at test group 705. at_banner_text_32="C++ Type Syntax (GLR)." # Banner 33. glr-regression.at:19 # Category starts at test group 714. at_banner_text_33="GLR Regression Tests" # Take any -C into account. if $at_change_dir ; then test x != "x$at_dir" && cd "$at_dir" \ || as_fn_error $? "unable to change directory" at_dir=`pwd` fi # Load the config files for any default variable assignments. for at_file in atconfig atlocal do test -r $at_file || continue . ./$at_file || as_fn_error $? "invalid content: $at_file" done # Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix: : "${at_top_build_prefix=$at_top_builddir}" # Perform any assignments requested during argument parsing. eval "$at_debug_args" # atconfig delivers names relative to the directory the test suite is # in, but the groups themselves are run in testsuite-dir/group-dir. if test -n "$at_top_srcdir"; then builddir=../.. for at_dir_var in srcdir top_srcdir top_build_prefix do eval at_val=\$at_$at_dir_var case $at_val in [\\/$]* | ?:[\\/]* ) at_prefix= ;; *) at_prefix=../../ ;; esac eval "$at_dir_var=\$at_prefix\$at_val" done fi ## -------------------- ## ## Directory structure. ## ## -------------------- ## # This is the set of directories and files used by this script # (non-literals are capitalized): # # TESTSUITE - the testsuite # TESTSUITE.log - summarizes the complete testsuite run # TESTSUITE.dir/ - created during a run, remains after -d or failed test # + at-groups/ - during a run: status of all groups in run # | + NNN/ - during a run: meta-data about test group NNN # | | + check-line - location (source file and line) of current AT_CHECK # | | + status - exit status of current AT_CHECK # | | + stdout - stdout of current AT_CHECK # | | + stder1 - stderr, including trace # | | + stderr - stderr, with trace filtered out # | | + test-source - portion of testsuite that defines group # | | + times - timestamps for computing duration # | | + pass - created if group passed # | | + xpass - created if group xpassed # | | + fail - created if group failed # | | + xfail - created if group xfailed # | | + skip - created if group skipped # + at-stop - during a run: end the run if this file exists # + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction # + 0..NNN/ - created for each group NNN, remains after -d or failed test # | + TESTSUITE.log - summarizes the group results # | + ... - files created during the group # The directory the whole suite works in. # Should be absolute to let the user `cd' at will. at_suite_dir=$at_dir/$as_me.dir # The file containing the suite ($at_dir might have changed since earlier). at_suite_log=$at_dir/$as_me.log # The directory containing helper files per test group. at_helper_dir=$at_suite_dir/at-groups # Stop file: if it exists, do not start new jobs. at_stop_file=$at_suite_dir/at-stop # The fifo used for the job dispatcher. at_job_fifo=$at_suite_dir/at-job-fifo if $at_clean; then test -d "$at_suite_dir" && find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; rm -f -r "$at_suite_dir" "$at_suite_log" exit $? fi # Don't take risks: use only absolute directories in PATH. # # For stand-alone test suites (ie. atconfig was not found), # AUTOTEST_PATH is relative to `.'. # # For embedded test suites, AUTOTEST_PATH is relative to the top level # of the package. Then expand it into build/src parts, since users # may create executables in both places. AUTOTEST_PATH=`printf "%s\n" "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"` at_path= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $AUTOTEST_PATH $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR case $as_dir in [\\/]* | ?:[\\/]* ) as_fn_append at_path "$as_dir" ;; * ) if test -z "$at_top_build_prefix"; then # Stand-alone test suite. as_fn_append at_path "$as_dir" else # Embedded test suite. as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR" as_fn_append at_path "$at_top_srcdir/$as_dir" fi ;; esac done IFS=$as_save_IFS # Now build and simplify PATH. # # There might be directories that don't exist, but don't redirect # builtins' (eg., cd) stderr directly: Ultrix's sh hates that. at_new_path= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $at_path do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -d "$as_dir" || continue case $as_dir in [\\/]* | ?:[\\/]* ) ;; * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;; esac case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;; $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;; *) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;; esac done IFS=$as_save_IFS PATH=$at_new_path export PATH # Setting up the FDs. # 5 is the log file. Not to be overwritten if `-d'. if $at_debug_p; then at_suite_log=/dev/null else : >"$at_suite_log" fi exec 5>>"$at_suite_log" # Banners and logs. printf "%s\n" "## --------------------------- ## ## GNU Bison 3.8.2 test suite. ## ## --------------------------- ##" { printf "%s\n" "## --------------------------- ## ## GNU Bison 3.8.2 test suite. ## ## --------------------------- ##" echo printf "%s\n" "$as_me: command line was:" printf "%s\n" " \$ $0 $at_cli_args" echo # If ChangeLog exists, list a few lines in case it might help determining # the exact version. if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then printf "%s\n" "## ---------- ## ## ChangeLog. ## ## ---------- ##" echo sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog" echo fi { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } echo # Contents of the config files. for at_file in atconfig atlocal do test -r $at_file || continue printf "%s\n" "$as_me: $at_file:" sed 's/^/| /' $at_file echo done } >&5 at_save_special_files () { for at_save_file in stderr experr expout do test ! -f at-bison-check-$at_save_file.bak || as_fn_error 1 "fatal error: back-up on top of a back-up" test ! -f $at_save_file || mv $at_save_file at-bison-check-$at_save_file.bak done } at_restore_special_files () { for at_save_file in stderr experr expout do test ! -f at-bison-check-$at_save_file.bak || mv at-bison-check-$at_save_file.bak $at_save_file done } ## ------------------------- ## ## Autotest shell functions. ## ## ------------------------- ## # at_fn_banner NUMBER # ------------------- # Output banner NUMBER, provided the testsuite is running multiple groups and # this particular banner has not yet been printed. at_fn_banner () { $at_print_banners || return 0 eval at_banner_text=\$at_banner_text_$1 test "x$at_banner_text" = "x " && return 0 eval "at_banner_text_$1=\" \"" if test -z "$at_banner_text"; then $at_first || echo else printf "%s\n" "$as_nl$at_banner_text$as_nl" fi } # at_fn_banner # at_fn_check_prepare_notrace REASON LINE # --------------------------------------- # Perform AT_CHECK preparations for the command at LINE for an untraceable # command; REASON is the reason for disabling tracing. at_fn_check_prepare_notrace () { $at_trace_echo "Not enabling shell tracing (command contains $1)" printf "%s\n" "$2" >"$at_check_line_file" at_check_trace=: at_check_filter=: : >"$at_stdout"; : >"$at_stderr" } # at_fn_check_prepare_trace LINE # ------------------------------ # Perform AT_CHECK preparations for the command at LINE for a traceable # command. at_fn_check_prepare_trace () { printf "%s\n" "$1" >"$at_check_line_file" at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace : >"$at_stdout"; : >"$at_stderr" } # at_fn_check_prepare_dynamic COMMAND LINE # ---------------------------------------- # Decide if COMMAND at LINE is traceable at runtime, and call the appropriate # preparation function. at_fn_check_prepare_dynamic () { case $1 in *$as_nl*) at_fn_check_prepare_notrace 'an embedded newline' "$2" ;; *) at_fn_check_prepare_trace "$2" ;; esac } # at_fn_filter_trace # ------------------ # Remove the lines in the file "$at_stderr" generated by "set -x" and print # them to stderr. at_fn_filter_trace () { mv "$at_stderr" "$at_stder1" grep '^ *+' "$at_stder1" >&2 grep -v '^ *+' "$at_stder1" >"$at_stderr" } # at_fn_log_failure FILE-LIST # --------------------------- # Copy the files in the list on stdout with a "> " prefix, and exit the shell # with a failure exit code. at_fn_log_failure () { for file do printf "%s\n" "$file:"; sed 's/^/> /' "$file"; done echo 1 > "$at_status_file" exit 1 } # at_fn_check_skip EXIT-CODE LINE # ------------------------------- # Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit # the test group subshell with that same exit code. Use LINE in any report # about test failure. at_fn_check_skip () { case $1 in 99) echo 99 > "$at_status_file"; at_failed=: printf "%s\n" "$2: hard failure"; exit 99;; 77) echo 77 > "$at_status_file"; exit 77;; esac } # at_fn_check_status EXPECTED EXIT-CODE LINE # ------------------------------------------ # Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing. # Otherwise, if it is 77 or 99, exit the test group subshell with that same # exit code; if it is anything else print an error message referring to LINE, # and fail the test. at_fn_check_status () { case $2 in $1 ) ;; 77) echo 77 > "$at_status_file"; exit 77;; 99) echo 99 > "$at_status_file"; at_failed=: printf "%s\n" "$3: hard failure"; exit 99;; *) printf "%s\n" "$3: exit code was $2, expected $1" at_failed=:;; esac } # at_fn_diff_devnull FILE # ----------------------- # Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff # invocations. at_fn_diff_devnull () { test -s "$1" || return 0 $at_diff "$at_devnull" "$1" } # at_fn_test NUMBER # ----------------- # Parse out test NUMBER from the tail of this file. at_fn_test () { eval at_sed=\$at_sed$1 sed "$at_sed" "$at_myself" > "$at_test_source" } # at_fn_create_debugging_script # ----------------------------- # Create the debugging script $at_group_dir/run which will reproduce the # current test group. at_fn_create_debugging_script () { { echo "#! /bin/sh" && echo 'test ${ZSH_VERSION+y} && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' && printf "%s\n" "cd '$at_dir'" && printf "%s\n" "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" && echo 'exit 1' } >"$at_group_dir/run" && chmod +x "$at_group_dir/run" } ## -------------------------------- ## ## End of autotest shell functions. ## ## -------------------------------- ## { printf "%s\n" "## ---------------- ## ## Tested programs. ## ## ---------------- ##" echo } >&5 # Report what programs are being tested. for at_program in : `eval echo $at_tested` do case $at_program in #( :) : continue ;; #( [\\/]* | ?:[\\/]*) : at_program_=$at_program ;; #( *) : as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -f "$as_dir$at_program" && break done IFS=$as_save_IFS at_program_=$as_dir$at_program ;; esac if test -f "$at_program_"; then { printf "%s\n" "$at_srcdir/local.at:1795: $at_program_ --version" "$at_program_" --version &5 2>&1 else as_fn_error $? "cannot find $at_program" "$LINENO" 5 fi done { printf "%s\n" "## ------------------ ## ## Running the tests. ## ## ------------------ ##" } >&5 at_start_date=`date` at_start_time=`date +%s 2>/dev/null` printf "%s\n" "$as_me: starting at: $at_start_date" >&5 # Create the master directory if it doesn't already exist. as_dir="$at_suite_dir"; as_fn_mkdir_p || as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5 # Can we diff with `/dev/null'? DU 5.0 refuses. if diff /dev/null /dev/null >/dev/null 2>&1; then at_devnull=/dev/null else at_devnull=$at_suite_dir/devnull >"$at_devnull" fi # Use `diff -u' when possible. if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff" then at_diff='diff -u' else at_diff=diff fi # Get the last needed group. for at_group in : $at_groups; do :; done # Extract the start and end lines of each test group at the tail # of this file awk ' BEGIN { FS="" } /^#AT_START_/ { start = NR } /^#AT_STOP_/ { test = substr ($ 0, 10) print "at_sed" test "=\"1," start "d;" (NR-1) "q\"" if (test == "'"$at_group"'") exit }' "$at_myself" > "$at_suite_dir/at-source-lines" && . "$at_suite_dir/at-source-lines" || as_fn_error $? "cannot create test line number cache" "$LINENO" 5 rm -f "$at_suite_dir/at-source-lines" # Set number of jobs for `-j'; avoid more jobs than test groups. set X $at_groups; shift; at_max_jobs=$# if test $at_max_jobs -eq 0; then at_jobs=1 fi if test $at_jobs -ne 1 && { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then at_jobs=$at_max_jobs fi # If parallel mode, don't output banners, don't split summary lines. if test $at_jobs -ne 1; then at_print_banners=false at_quiet=: fi # Set up helper dirs. rm -rf "$at_helper_dir" && mkdir "$at_helper_dir" && cd "$at_helper_dir" && { test -z "$at_groups" || mkdir $at_groups; } || as_fn_error $? "testsuite directory setup failed" "$LINENO" 5 # Functions for running a test group. We leave the actual # test group execution outside of a shell function in order # to avoid hitting zsh 4.x exit status bugs. # at_fn_group_prepare # ------------------- # Prepare for running a test group. at_fn_group_prepare () { # The directory for additional per-group helper files. at_job_dir=$at_helper_dir/$at_group # The file containing the location of the last AT_CHECK. at_check_line_file=$at_job_dir/check-line # The file containing the exit status of the last command. at_status_file=$at_job_dir/status # The files containing the output of the tested commands. at_stdout=$at_job_dir/stdout at_stder1=$at_job_dir/stder1 at_stderr=$at_job_dir/stderr # The file containing the code for a test group. at_test_source=$at_job_dir/test-source # The file containing dates. at_times_file=$at_job_dir/times # Be sure to come back to the top test directory. cd "$at_suite_dir" # Clearly separate the test groups when verbose. $at_first || $at_verbose echo at_group_normalized=$at_group eval 'while :; do case $at_group_normalized in #( '"$at_format"'*) break;; esac at_group_normalized=0$at_group_normalized done' # Create a fresh directory for the next test group, and enter. # If one already exists, the user may have invoked ./run from # within that directory; we remove the contents, but not the # directory itself, so that we aren't pulling the rug out from # under the shell's notion of the current directory. at_group_dir=$at_suite_dir/$at_group_normalized at_group_log=$at_group_dir/$as_me.log if test -d "$at_group_dir" then find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \; rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??* fi || { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5 printf "%s\n" "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;} # Be tolerant if the above `rm' was not able to remove the directory. as_dir="$at_group_dir"; as_fn_mkdir_p echo 0 > "$at_status_file" # In verbose mode, append to the log file *and* show on # the standard output; in quiet mode only write to the log. if test -z "$at_verbose"; then at_tee_pipe='tee -a "$at_group_log"' else at_tee_pipe='cat >> "$at_group_log"' fi } # at_fn_group_banner ORDINAL LINE DESC PAD [BANNER] # ------------------------------------------------- # Declare the test group ORDINAL, located at LINE with group description DESC, # and residing under BANNER. Use PAD to align the status column. at_fn_group_banner () { at_setup_line="$2" test -n "$5" && at_fn_banner $5 at_desc="$3" case $1 in [0-9]) at_desc_line=" $1: ";; [0-9][0-9]) at_desc_line=" $1: " ;; *) at_desc_line="$1: " ;; esac as_fn_append at_desc_line "$3$4" $at_quiet printf %s "$at_desc_line" echo "# -*- compilation -*-" >> "$at_group_log" } # at_fn_group_postprocess # ----------------------- # Perform cleanup after running a test group. at_fn_group_postprocess () { # Be sure to come back to the suite directory, in particular # since below we might `rm' the group directory we are in currently. cd "$at_suite_dir" if test ! -f "$at_check_line_file"; then sed "s/^ */$as_me: WARNING: /" <<_ATEOF A failure happened in a test group before any test could be run. This means that test suite is improperly designed. Please report this failure to . _ATEOF printf "%s\n" "$at_setup_line" >"$at_check_line_file" at_status=99 fi $at_verbose printf %s "$at_group. $at_setup_line: " printf %s "$at_group. $at_setup_line: " >> "$at_group_log" case $at_xfail:$at_status in yes:0) at_msg="UNEXPECTED PASS" at_res=xpass at_errexit=$at_errexit_p at_color=$at_red ;; no:0) at_msg="ok" at_res=pass at_errexit=false at_color=$at_grn ;; *:77) at_msg='skipped ('`cat "$at_check_line_file"`')' at_res=skip at_errexit=false at_color=$at_blu ;; no:* | *:99) at_msg='FAILED ('`cat "$at_check_line_file"`')' at_res=fail at_errexit=$at_errexit_p at_color=$at_red ;; yes:*) at_msg='expected failure ('`cat "$at_check_line_file"`')' at_res=xfail at_errexit=false at_color=$at_lgn ;; esac echo "$at_res" > "$at_job_dir/$at_res" # In parallel mode, output the summary line only afterwards. if test $at_jobs -ne 1 && test -n "$at_verbose"; then printf "%s\n" "$at_desc_line $at_color$at_msg$at_std" else # Make sure there is a separator even with long titles. printf "%s\n" " $at_color$at_msg$at_std" fi at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg" case $at_status in 0|77) # $at_times_file is only available if the group succeeded. # We're not including the group log, so the success message # is written in the global log separately. But we also # write to the group log in case they're using -d. if test -f "$at_times_file"; then at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')' rm -f "$at_times_file" fi printf "%s\n" "$at_log_msg" >> "$at_group_log" printf "%s\n" "$at_log_msg" >&5 # Cleanup the group directory, unless the user wants the files # or the success was unexpected. if $at_debug_p || test $at_res = xpass; then at_fn_create_debugging_script if test $at_res = xpass && $at_errexit; then echo stop > "$at_stop_file" fi else if test -d "$at_group_dir"; then find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; rm -fr "$at_group_dir" fi rm -f "$at_test_source" fi ;; *) # Upon failure, include the log into the testsuite's global # log. The failure message is written in the group log. It # is later included in the global log. printf "%s\n" "$at_log_msg" >> "$at_group_log" # Upon failure, keep the group directory for autopsy, and create # the debugging script. With -e, do not start any further tests. at_fn_create_debugging_script if $at_errexit; then echo stop > "$at_stop_file" fi ;; esac } ## ------------ ## ## Driver loop. ## ## ------------ ## if (set -m && set +m && set +b) >/dev/null 2>&1; then set +b at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=- else at_job_control_on=: at_job_control_off=: at_job_group= fi for at_signal in 1 2 15; do trap 'set +x; set +e $at_job_control_off at_signal='"$at_signal"' echo stop > "$at_stop_file" trap "" $at_signal at_pgids= for at_pgid in `jobs -p 2>/dev/null`; do at_pgids="$at_pgids $at_job_group$at_pgid" done test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null wait if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then echo >&2 fi at_signame=`kill -l $at_signal 2>&1 || echo $at_signal` set x $at_signame test 0 -gt 2 && at_signame=$at_signal { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5 printf "%s\n" "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;} as_fn_arith 128 + $at_signal && exit_status=$as_val as_fn_exit $exit_status' $at_signal done rm -f "$at_stop_file" at_first=: if test $at_jobs -ne 1 && rm -f "$at_job_fifo" && test -n "$at_job_group" && ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null then # FIFO job dispatcher. trap 'at_pids= for at_pid in `jobs -p`; do at_pids="$at_pids $at_job_group$at_pid" done if test -n "$at_pids"; then at_sig=TSTP test ${TMOUT+y} && at_sig=STOP kill -$at_sig $at_pids 2>/dev/null fi kill -STOP $$ test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP echo # Turn jobs into a list of numbers, starting from 1. at_joblist=`printf "%s\n" "$at_groups" | sed -n 1,${at_jobs}p` set X $at_joblist shift for at_group in $at_groups; do $at_job_control_on 2>/dev/null ( # Start one test group. $at_job_control_off if $at_first; then exec 7>"$at_job_fifo" else exec 6<&- fi trap 'set +x; set +e trap "" PIPE echo stop > "$at_stop_file" echo >&7 as_fn_exit 141' PIPE at_fn_group_prepare if cd "$at_group_dir" && at_fn_test $at_group && . "$at_test_source" then :; else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5 printf "%s\n" "$as_me: WARNING: unable to parse test group: $at_group" >&2;} at_failed=: fi at_fn_group_postprocess echo >&7 ) & $at_job_control_off if $at_first; then at_first=false exec 6<"$at_job_fifo" 7>"$at_job_fifo" fi shift # Consume one token. if test $# -gt 0; then :; else read at_token <&6 || break set x $* fi test -f "$at_stop_file" && break done exec 7>&- # Read back the remaining ($at_jobs - 1) tokens. set X $at_joblist shift if test $# -gt 0; then shift for at_job do read at_token done <&6 fi exec 6<&- wait else # Run serially, avoid forks and other potential surprises. for at_group in $at_groups; do at_fn_group_prepare if cd "$at_group_dir" && at_fn_test $at_group && . "$at_test_source"; then :; else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5 printf "%s\n" "$as_me: WARNING: unable to parse test group: $at_group" >&2;} at_failed=: fi at_fn_group_postprocess test -f "$at_stop_file" && break at_first=false done fi # Wrap up the test suite with summary statistics. cd "$at_helper_dir" # Use ?..???? when the list must remain sorted, the faster * otherwise. at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'` at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'` at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'` at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do echo $f; done | sed '/?/d; s,/xpass,,'` at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do echo $f; done | sed '/?/d; s,/fail,,'` set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list shift; at_group_count=$# set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$* set X $at_xfail_list; shift; at_xfail_count=$# set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$* set X $at_skip_list; shift; at_skip_count=$# as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val # Back to the top directory. cd "$at_dir" rm -rf "$at_helper_dir" # Compute the duration of the suite. at_stop_date=`date` at_stop_time=`date +%s 2>/dev/null` printf "%s\n" "$as_me: ending at: $at_stop_date" >&5 case $at_start_time,$at_stop_time in [0-9]*,[0-9]*) as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s" printf "%s\n" "$as_me: test suite duration: $at_duration" >&5 ;; esac echo printf "%s\n" "## ------------- ## ## Test results. ## ## ------------- ##" echo { echo printf "%s\n" "## ------------- ## ## Test results. ## ## ------------- ##" echo } >&5 if test $at_run_count = 1; then at_result="1 test" at_were=was else at_result="$at_run_count tests" at_were=were fi if $at_errexit_p && test $at_unexpected_count != 0; then if test $at_xpass_count = 1; then at_result="$at_result $at_were run, one passed" else at_result="$at_result $at_were run, one failed" fi at_result="$at_result unexpectedly and inhibited subsequent tests." at_color=$at_red else # Don't you just love exponential explosion of the number of cases? at_color=$at_red case $at_xpass_count:$at_fail_count:$at_xfail_count in # So far, so good. 0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;; 0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;; # Some unexpected failures 0:*:0) at_result="$at_result $at_were run, $at_fail_count failed unexpectedly." ;; # Some failures, both expected and unexpected 0:*:1) at_result="$at_result $at_were run, $at_total_fail_count failed ($at_xfail_count expected failure)." ;; 0:*:*) at_result="$at_result $at_were run, $at_total_fail_count failed ($at_xfail_count expected failures)." ;; # No unexpected failures, but some xpasses *:0:*) at_result="$at_result $at_were run, $at_xpass_count passed unexpectedly." ;; # No expected failures, but failures and xpasses *:1:0) at_result="$at_result $at_were run, $at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;; *:*:0) at_result="$at_result $at_were run, $at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;; # All of them. *:*:1) at_result="$at_result $at_were run, $at_xpass_count passed unexpectedly, $at_total_fail_count failed ($at_xfail_count expected failure)." ;; *:*:*) at_result="$at_result $at_were run, $at_xpass_count passed unexpectedly, $at_total_fail_count failed ($at_xfail_count expected failures)." ;; esac if test $at_skip_count = 0 && test $at_run_count -gt 1; then at_result="All $at_result" fi fi # Now put skips in the mix. case $at_skip_count in 0) ;; 1) at_result="$at_result 1 test was skipped." ;; *) at_result="$at_result $at_skip_count tests were skipped." ;; esac if test $at_unexpected_count = 0; then echo "$at_color$at_result$at_std" echo "$at_result" >&5 else echo "${at_color}ERROR: $at_result$at_std" >&2 echo "ERROR: $at_result" >&5 { echo printf "%s\n" "## ------------------------ ## ## Summary of the failures. ## ## ------------------------ ##" # Summary of failed and skipped tests. if test $at_fail_count != 0; then echo "Failed tests:" $SHELL "$at_myself" $at_fail_list --list echo fi if test $at_skip_count != 0; then echo "Skipped tests:" $SHELL "$at_myself" $at_skip_list --list echo fi if test $at_xpass_count != 0; then echo "Unexpected passes:" $SHELL "$at_myself" $at_xpass_list --list echo fi if test $at_fail_count != 0; then printf "%s\n" "## ---------------------- ## ## Detailed failed tests. ## ## ---------------------- ##" echo for at_group in $at_fail_list do at_group_normalized=$at_group eval 'while :; do case $at_group_normalized in #( '"$at_format"'*) break;; esac at_group_normalized=0$at_group_normalized done' cat "$at_suite_dir/$at_group_normalized/$as_me.log" echo done echo fi if test -n "$at_top_srcdir"; then sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## ${at_top_build_prefix}config.log ## _ASBOX sed 's/^/| /' ${at_top_build_prefix}config.log echo fi } >&5 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## $as_me.log was created. ## _ASBOX echo if $at_debug_p; then at_msg='per-test log files' else at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'" fi at_msg1a=${at_xpass_list:+', '} at_msg1=$at_fail_list${at_fail_list:+" failed$at_msg1a"} at_msg2=$at_xpass_list${at_xpass_list:+" passed unexpectedly"} printf "%s\n" "Please send $at_msg and all information you think might help: To: Subject: [GNU Bison 3.8.2] $as_me: $at_msg1$at_msg2 You may investigate any problem if you feel able to do so, in which case the test suite provides a good starting point. Its output may be found below \`${at_testdir+${at_testdir}/}$as_me.dir'. " exit 1 fi exit 0 ## ------------- ## ## Actual tests. ## ## ------------- ## #AT_START_1 at_fn_group_banner 1 'm4.at:21' \ "Generating Comments" " " 1 at_xfail=no ( printf "%s\n" "1. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: _ATEOF cat >input.m4 <<'_ATEOF' m4_include(b4_skeletonsdir/[c.m4]) b4_output_begin([output.txt]) b4_gsub([[abcd]], [a], [b]) b4_gsub([[abcd]], [a], [b], [b], [c], [c], [d]) _b4_comment([["/* () */"]]) _b4_comment([["/* ( */"]]) _b4_comment([["/* ) */"]]) _b4_comment([["/* [] */"]]) b4_comment([["/* () */"]]) b4_comment([["/* ( */"]]) b4_comment([["/* ) */"]]) b4_comment([["/* [] */"]]) b4_output_end([output.txt]) _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/m4.at:53: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -S ./input.m4 input.y" at_fn_check_prepare_notrace 'an embedded newline' "m4.at:53" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -S ./input.m4 input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/m4.at:53" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/m4.at:53: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -S ./input.m4 input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -S ./input.m4 input.y" "m4.at:53" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -S ./input.m4 input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/m4.at:53" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/m4.at:53: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "m4.at:53" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/m4.at:53" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/m4.at:53: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "m4.at:53" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/m4.at:53" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/m4.at:53: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "m4.at:53" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/m4.at:53" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/m4.at:53: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -S ./input.m4 input.y" at_fn_check_prepare_trace "m4.at:53" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -S ./input.m4 input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/m4.at:53" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/m4.at:55: cat output.txt" at_fn_check_prepare_trace "m4.at:55" ( $at_check_trace; cat output.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " [bbcd] [dddd] \"/\\* () *\\/\" \"/\\* ( *\\/\" \"/\\* ) *\\/\" \"/\\* [] *\\/\" /* \"/\\* () *\\/\" */ /* \"/\\* ( *\\/\" */ /* \"/\\* ) *\\/\" */ /* \"/\\* [] *\\/\" */ " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/m4.at:55" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_1 #AT_START_2 at_fn_group_banner 2 'input.at:27' \ "Invalid number of arguments" " " 2 at_xfail=no ( printf "%s\n" "2. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/input.at:29: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret " at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret " "input.at:29" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "bison: missing operand Try 'bison --help' for more information. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:29" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:34: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y 2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y 2.y" "input.at:34" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "bison: extra operand '2.y' Try 'bison --help' for more information. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:34" $at_failed && at_fn_log_failure $at_traceon; } # For some reason, on some systems we use the system's getopt, not the # one we ship in gnulib. So we can get two different error messages. # See https://lists.gnu.org/r/bison-patches/2018-10/msg00154.html { set +x printf "%s\n" "$at_srcdir/input.at:42: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --skeleton" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --skeleton" "input.at:42" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --skeleton ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:42" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:43: sed -e \\ \"s/requires an argument -- skeleton/'--skeleton' requires an argument/\" \\ stderr" at_fn_check_prepare_notrace 'an embedded newline' "input.at:43" ( $at_check_trace; sed -e \ "s/requires an argument -- skeleton/'--skeleton' requires an argument/" \ stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "bison: option '--skeleton' requires an argument Try 'bison --help' for more information. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:43" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_2 #AT_START_3 at_fn_group_banner 3 'input.at:58' \ "Invalid options" " " 2 at_xfail=no ( printf "%s\n" "3. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: '0' _ATEOF # We used to accept these, as -f, --report and others were sharing # their code with -W. { set +x printf "%s\n" "$at_srcdir/input.at:67: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -ferror=caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -ferror=caret input.y" "input.at:67" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -ferror=caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:67" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=error=itemsets input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=error=itemsets input.y" "input.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=error=itemsets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:68" $at_failed && at_fn_log_failure $at_traceon; } # We used to accept any character after "-Werror", instead of ensuring # this is "=". { set +x printf "%s\n" "$at_srcdir/input.at:72: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror?all input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror?all input.y" "input.at:72" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror?all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:72" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_3 #AT_START_4 at_fn_group_banner 4 'input.at:83' \ "Invalid inputs" " " 2 at_xfail=no ( printf "%s\n" "4. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %header "\360\000\200\210" \000\001\002\377? "\000" %% ? default: 'a' } %& %a-does-not-exist %- %{ _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:97: \"\$PERL\" -pi -e 's/\\\\(\\d{3})/chr(oct(\$1))/ge' input.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's/\\\\(\\d{3})/chr(oct($1))/ge' input.y || exit 77" "input.at:97" ( $at_check_trace; "$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:97" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:99: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:99" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:99" $at_failed && at_fn_log_failure $at_traceon; } # Autotest's diffing, when there are NUL bytes, just reports "binary # files differ". So don't leave NUL bytes. And don't leave invalid # mbchars either: escape raw binary. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/input.at:104: \"\$PERL\" -p -e 's{([\\0\\200\\210\\360\\377])}{sprintf \"\\\\x%02x\", ord(\$1)}ge' stderr" at_fn_check_prepare_dynamic "\"$PERL\" -p -e 's{([\\0\\200\\210\\360\\377])}{sprintf \"\\\\x%02x\", ord($1)}ge' stderr" "input.at:104" ( $at_check_trace; "$PERL" -p -e 's{([\0\200\210\360\377])}{sprintf "\\x%02x", ord($1)}ge' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:1.11: error: invalid null character 1 | %header \"\\xf0\\x00\\x80\\x88\" | ^ input.y:2.1-2: error: invalid characters: '\\0\\001\\002\\377?' 2 | \\x00\\xff? | ^~ input.y:3.2: error: invalid null character 3 | \"\\x00\" | ^ input.y:5.1: error: invalid character: '?' 5 | ? | ^ input.y:6.14: error: invalid character: '}' 6 | default: 'a' } | ^ input.y:7.1: error: invalid character: '%' 7 | %& | ^ input.y:7.2: error: invalid character: '&' 7 | %& | ^ input.y:8.1-17: error: invalid directive: '%a-does-not-exist' 8 | %a-does-not-exist | ^~~~~~~~~~~~~~~~~ input.y:9.1: error: invalid character: '%' 9 | %- | ^ input.y:9.2: error: invalid character: '-' 9 | %- | ^ input.y:10.1-11.0: error: missing '%}' at end of file 10 | %{ | ^~ " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:104" $at_failed && at_fn_log_failure $at_traceon; } fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_4 #AT_START_5 at_fn_group_banner 5 'input.at:147' \ "Invalid inputs with {}" " " 2 at_xfail=no ( printf "%s\n" "5. $at_setup_line: testing $at_desc ..." $at_traceon # We used to SEGV here. See # https://lists.gnu.org/r/bug-bison/2005-07/msg00053.html cat >input.y <<'_ATEOF' %destructor %initial-action %lex-param %parse-param %printer %union _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:162: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:162" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-15: error: expected {...} before %initial-action " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:162" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_5 #AT_START_6 at_fn_group_banner 6 'input.at:173' \ "Yacc warnings on symbols" " " 2 at_xfail=no ( printf "%s\n" "6. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %nterm exp %token NUM 0x40 "number" %% exp: "number"; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wyacc input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y" "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:182: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:182" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:182: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:182" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:182: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:182" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wyacc input.y" at_fn_check_prepare_trace "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] 1 | %nterm exp | ^~~~~~ input.y:2.12-15: warning: POSIX Yacc does not support hexadecimal literals [-Wyacc] 2 | %token NUM 0x40 \"number\" | ^~~~ input.y:2.17-24: warning: POSIX Yacc does not support string literals [-Wyacc] 2 | %token NUM 0x40 \"number\" | ^~~~~~~~ input.y:4.6-13: warning: POSIX Yacc does not support string literals [-Wyacc] 4 | exp: \"number\"; | ^~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror" "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] 1 | %nterm exp | ^~~~~~ input.y:2.12-15: warning: POSIX Yacc does not support hexadecimal literals [-Wyacc] 2 | %token NUM 0x40 "number" | ^~~~ input.y:2.17-24: warning: POSIX Yacc does not support string literals [-Wyacc] 2 | %token NUM 0x40 "number" | ^~~~~~~~ input.y:4.6-13: warning: POSIX Yacc does not support string literals [-Wyacc] 4 | exp: "number"; | ^~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:182: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:182" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error" "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none" "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none" "input.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:182" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_6 #AT_START_7 at_fn_group_banner 7 'input.at:204' \ "Yacc warnings" " " 2 at_xfail=no ( printf "%s\n" "7. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %destructor {} %printer {} %type exp a b %% exp: a b { $$ = $1 + $2; }; a: { $$ = 42; } { $$ = $1; }; b: %empty { $$ = 42; }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wyacc input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y" "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:216: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:216" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:216: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:216" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:216: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:216" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wyacc input.y" at_fn_check_prepare_trace "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-11: warning: POSIX Yacc does not support %destructor [-Wyacc] 1 | %destructor {} | ^~~~~~~~~~~ input.y:2.1-8: warning: POSIX Yacc does not support %printer [-Wyacc] 2 | %printer {} | ^~~~~~~~ input.y:6.9-20: warning: POSIX Yacc does not support typed midrule actions [-Wyacc] 6 | a: { \$\$ = 42; } { \$\$ = \$1; }; | ^~~~~~~~~~~~ input.y:7.4-9: warning: POSIX Yacc does not support %empty [-Wyacc] 7 | b: %empty { \$\$ = 42; }; | ^~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror" "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.1-11: warning: POSIX Yacc does not support %destructor [-Wyacc] 1 | %destructor {} | ^~~~~~~~~~~ input.y:2.1-8: warning: POSIX Yacc does not support %printer [-Wyacc] 2 | %printer {} | ^~~~~~~~ input.y:6.9-20: warning: POSIX Yacc does not support typed midrule actions [-Wyacc] 6 | a: { $$ = 42; } { $$ = $1; }; | ^~~~~~~~~~~~ input.y:7.4-9: warning: POSIX Yacc does not support %empty [-Wyacc] 7 | b: %empty { $$ = 42; }; | ^~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:216: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:216" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error" "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none" "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:216: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none" "input.at:216" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:216" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_7 #AT_START_8 at_fn_group_banner 8 'input.at:238' \ "Yacc's %type" " " 2 at_xfail=no ( printf "%s\n" "8. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token TOKEN1 %nterm nterm1 %type TOKEN1 TOKEN2 "TOKEN3" nterm1 nterm2 nterm3 '+' %token TOKEN2 %nterm nterm2 %% expr: nterm1 nterm2 nterm3 nterm1: TOKEN1 nterm2: TOKEN2 nterm3: "TOKEN3" _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wyacc input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y" "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:253: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:253" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:253: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:253" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:253: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:253" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wyacc input.y" at_fn_check_prepare_trace "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wyacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] 2 | %nterm nterm1 | ^~~~~~ input.y:3.14-19: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 \"TOKEN3\" nterm1 nterm2 nterm3 '+' | ^~~~~~ input.y:3.28-35: warning: POSIX Yacc does not support string literals [-Wyacc] 3 | %type TOKEN1 TOKEN2 \"TOKEN3\" nterm1 nterm2 nterm3 '+' | ^~~~~~~~ input.y:3.28-35: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 \"TOKEN3\" nterm1 nterm2 nterm3 '+' | ^~~~~~~~ input.y:3.58-60: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 \"TOKEN3\" nterm1 nterm2 nterm3 '+' | ^~~ input.y:5.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] 5 | %nterm nterm2 | ^~~~~~ input.y:3.21-26: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 \"TOKEN3\" nterm1 nterm2 nterm3 '+' | ^~~~~~ input.y:10.9-16: warning: POSIX Yacc does not support string literals [-Wyacc] 10 | nterm3: \"TOKEN3\" | ^~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror" "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] 2 | %nterm nterm1 | ^~~~~~ input.y:3.14-19: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 "TOKEN3" nterm1 nterm2 nterm3 '+' | ^~~~~~ input.y:3.28-35: warning: POSIX Yacc does not support string literals [-Wyacc] 3 | %type TOKEN1 TOKEN2 "TOKEN3" nterm1 nterm2 nterm3 '+' | ^~~~~~~~ input.y:3.28-35: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 "TOKEN3" nterm1 nterm2 nterm3 '+' | ^~~~~~~~ input.y:3.58-60: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 "TOKEN3" nterm1 nterm2 nterm3 '+' | ^~~ input.y:5.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] 5 | %nterm nterm2 | ^~~~~~ input.y:3.21-26: warning: POSIX yacc reserves %type to nonterminals [-Wyacc] 3 | %type TOKEN1 TOKEN2 "TOKEN3" nterm1 nterm2 nterm3 '+' | ^~~~~~ input.y:10.9-16: warning: POSIX Yacc does not support string literals [-Wyacc] 10 | nterm3: "TOKEN3" | ^~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:253: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:253" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error" "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none" "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none" "input.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wyacc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:253" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_8 #AT_START_9 at_fn_group_banner 9 'input.at:287' \ "Invalid symbol declarations" " " 2 at_xfail=no ( printf "%s\n" "9. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %nterm expr "expression"; %nterm term 123; %nterm fact 124 "factor"; %nterm '+' '*'; %nterm "number"; %token "tok1" 1; %left "tok2" 2; %type "tok3" 3; %% expr: expr '+' term | term; term: term '*' fact | fact; fact: "number"; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:304: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:304" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.13-24: error: nonterminals cannot be given a string alias 1 | %nterm expr \"expression\"; | ^~~~~~~~~~~~ input.y:2.13-15: error: nonterminals cannot be given a token code 2 | %nterm term 123; | ^~~ input.y:3.13-15: error: nonterminals cannot be given a token code 3 | %nterm fact 124 \"factor\"; | ^~~ input.y:3.17-24: error: nonterminals cannot be given a string alias 3 | %nterm fact 124 \"factor\"; | ^~~~~~~~ input.y:4.8-10: error: character literals cannot be nonterminals 4 | %nterm '+' '*'; | ^~~ input.y:5.8-15: error: expected character literal or identifier or before string 5 | %nterm \"number\"; | ^~~~~~~~ input.y:6.8-13: error: expected character literal or identifier or before string 6 | %token \"tok1\" 1; | ^~~~~~ input.y:7.14: error: unexpected integer literal 7 | %left \"tok2\" 2; | ^ input.y:8.14: error: unexpected integer literal 8 | %type \"tok3\" 3; | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:304" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_9 #AT_START_10 at_fn_group_banner 10 'input.at:341' \ "Redefining the error token" " " 2 at_xfail=no ( printf "%s\n" "10. $at_setup_line: testing $at_desc ..." $at_traceon # We used to crash when trying to display the original definition of # "error", which is a builtin without any location. cat >input.y <<'_ATEOF' %token error 123 %token error 124 %% exp: _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-12: warning: symbol error redeclared [-Wother] 2 | %token error 124 | ^~~~~ input.y:1.8-12: note: previous declaration 1 | %token error 123 | ^~~~~ input.y:2.14-16: error: redefining code of token error 2 | %token error 124 | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:354" $at_failed && at_fn_log_failure $at_traceon; } # While at it, make sure we properly used the user's number for # "error". I don't see what it buys us, but... cat >input.y <<'_ATEOF' %{ #include #include /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } %} %token error 123 %% exp: %% int main (void) { assert (YYerror == 123); assert (YYTRANSLATE (YYEOF) == YYSYMBOL_YYEOF); assert (YYTRANSLATE (YYerror) == YYSYMBOL_YYerror); assert (YYTRANSLATE (YYUNDEF) == YYSYMBOL_YYUNDEF); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:390: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:390" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:390: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:390" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:390: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:390" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:390: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:390" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:390: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:390" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:390: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:390" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "input.at:390" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/input.at:390" { set +x printf "%s\n" "$at_srcdir/input.at:390: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "input.at:390" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:391: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "input.at:391" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "input.at:391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:391" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_10 #AT_START_11 at_fn_group_banner 11 'input.at:401' \ "Dangling aliases" " " 2 at_xfail=no ( printf "%s\n" "11. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token FOO "foo" %type "bar" %% expr: "foo" "bar" "baz" _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wdangling input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wdangling input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wdangling input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wdangling input.y" "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wdangling input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:410: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:410" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:410: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:410" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:410: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:410" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wdangling input.y" at_fn_check_prepare_trace "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wdangling input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.13-17: warning: string literal \"bar\" not attached to a symbol [-Wdangling-alias] 2 | %type \"bar\" | ^~~~~ input.y:4.19-23: warning: string literal \"baz\" not attached to a symbol [-Wdangling-alias] 4 | expr: \"foo\" \"bar\" \"baz\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y -Werror" "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.13-17: warning: string literal "bar" not attached to a symbol [-Wdangling-alias] 2 | %type "bar" | ^~~~~ input.y:4.19-23: warning: string literal "baz" not attached to a symbol [-Wdangling-alias] 4 | expr: "foo" "bar" "baz" | ^~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:410: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:410" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y --warnings=error" "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y -Wnone,none -Werror --trace=none" "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y --warnings=none -Werror --trace=none" "input.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wdangling input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:410" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_11 #AT_START_12 at_fn_group_banner 12 'input.at:427' \ "Symbol declarations" " " 2 at_xfail=no ( printf "%s\n" "12. $at_setup_line: testing $at_desc ..." $at_traceon cat >dump-symbols.m4 <<'_ATEOF' m4_define([b4_api_PREFIX], [YY]) m4_define([b4_symbol_dump], [$1, dnl b4_symbol_if([$1], [is_token], [Token], [Nonterminal]), dnl b4_symbol([$1], [tag]), dnl b4_symbol([$1], [id]), dnl b4_symbol([$1], [code]), dnl b4_symbol([$1], [type]), ]) b4_output_begin([symbols.csv]) number, class, tag, id, code, type, b4_symbol_foreach([b4_symbol_dump])dnl b4_output_end _ATEOF cat >input.y <<'_ATEOF' %token 'a' A1 1 "A1" A2 A3 "A3" A4 4 'b' B5 5 "B5" B6 B7 "B8" B9 9 'c' C10 10 "C10" C11 C12 "C12" C13 13 %left 'd' D20 20 "D20" D21 D22 "D22" D23 23 'e' E25 25 "E25" E26 E27 "E28" E29 29 'f' F30 30 "F30" F31 F32 "F32" F33 33 %type 'g' G40 "D40" G21 G22 G23 'h' H25 "H25" H26 H27 "H28" H29 'i' I30 "I30" I31 I32 "I32" I33 %nterm j60 j61 j62 j63 k75 k76 k77 k79 l80 l81 l82 l83 %% exp:; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:467: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S./dump-symbols.m4 input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:467" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S./dump-symbols.m4 input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:467" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:467: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S./dump-symbols.m4 input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S./dump-symbols.m4 input.y" "input.at:467" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S./dump-symbols.m4 input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:467" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:467: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:467" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:467" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:467: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:467" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:467" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:467: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:467" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:467" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:467: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S./dump-symbols.m4 input.y" at_fn_check_prepare_trace "input.at:467" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S./dump-symbols.m4 input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:467" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:468: cat symbols.csv" at_fn_check_prepare_trace "input.at:468" ( $at_check_trace; cat symbols.csv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "number, class, tag, id, code, type, 0, Token, \"end of file\", YYEOF, 0, , 1, Token, error, YYerror, 256, , 2, Token, \"invalid token\", YYUNDEF, 257, , 3, Token, 'a', , 97, , 4, Token, \"A1\", A1, 1, , 5, Token, A2, A2, 258, , 6, Token, \"A3\", A3, 259, , 7, Token, A4, A4, 4, , 8, Token, 'b', , 98, type_b, 9, Token, \"B5\", B5, 5, type_b, 10, Token, B6, B6, 260, type_b, 11, Token, \"B8\", B7, 261, type_b, 12, Token, B9, B9, 9, type_b, 13, Token, 'c', , 99, type_c, 14, Token, \"C10\", C10, 10, type_c, 15, Token, C11, C11, 262, type_c, 16, Token, \"C12\", C12, 263, type_c, 17, Token, C13, C13, 13, type_c, 18, Token, 'd', , 100, , 19, Token, D20, D20, 20, , 20, Token, \"D20\", , 264, , 21, Token, D21, D21, 265, , 22, Token, D22, D22, 266, , 23, Token, \"D22\", , 267, , 24, Token, D23, D23, 23, , 25, Token, 'e', , 101, type_e, 26, Token, E25, E25, 25, type_e, 27, Token, \"E25\", , 268, type_e, 28, Token, E26, E26, 269, type_e, 29, Token, E27, E27, 270, type_e, 30, Token, \"E28\", , 271, type_e, 31, Token, E29, E29, 29, type_e, 32, Token, 'f', , 102, type_f, 33, Token, F30, F30, 30, type_f, 34, Token, \"F30\", , 272, type_f, 35, Token, F31, F31, 273, type_f, 36, Token, F32, F32, 274, type_f, 37, Token, \"F32\", , 275, type_f, 38, Token, F33, F33, 33, type_f, 39, Token, 'g', , 103, , 40, Token, \"D40\", , 276, , 41, Token, 'h', , 104, type_h, 42, Token, \"H25\", , 277, type_h, 43, Token, \"H28\", , 278, type_h, 44, Token, 'i', , 105, type_i, 45, Token, \"I30\", , 279, type_i, 46, Token, \"I32\", , 280, type_i, 47, Nonterminal, \$accept, , -1, , 48, Nonterminal, exp, exp, -1, , " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:468" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_12 #AT_START_13 at_fn_group_banner 13 'input.at:528' \ "Invalid \$n and @n" " " 2 at_xfail=no ( printf "%s\n" "13. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: %empty { $$ = $1 ; }; exp: %empty { @$ = @1 ; }; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:536: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:536" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.20-21: error: integer out of range: '\$1' 2 | exp: %empty { \$\$ = \$1 ; }; | ^~ input.y:3.20-21: error: integer out of range: '@1' 3 | exp: %empty { @\$ = @1 ; }; | ^~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:536" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_13 #AT_START_14 at_fn_group_banner 14 'input.at:552' \ "Type Clashes" " " 2 at_xfail=no ( printf "%s\n" "14. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %union { int bar; } %token foo %type exp %% exp: foo { $$; } foo { $2; } foo | foo | %empty ; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:565: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:565" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:5.12-13: error: \$\$ for the midrule at \$2 of 'exp' has no declared type 5 | exp: foo { \$\$; } foo { \$2; } foo | ^~ input.y:5.24-25: error: \$2 of 'exp' has no declared type 5 | exp: foo { \$\$; } foo { \$2; } foo | ^~ input.y:5.6-32: warning: type clash on default action: != <> [-Wother] 5 | exp: foo { \$\$; } foo { \$2; } foo | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:6.6-8: warning: type clash on default action: != <> [-Wother] 6 | | foo | ^~~ input.y:7.6-11: warning: empty rule for typed nonterminal, and no action [-Wother] 7 | | %empty | ^~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:565" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_14 #AT_START_15 at_fn_group_banner 15 'input.at:774' \ "Unused values" " " 2 at_xfail=no ( printf "%s\n" "15. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token INT; %type a b c d e f g h i j k l m n o; %destructor { destroy ($$); } ; %% start: 'a' a { $2; } | 'b' b { $2; } | 'c' c { $2; } | 'd' d { $2; } | 'e' e { $2; } | 'f' f { $2; } | 'g' g { $2; } | 'h' h { $2; } | 'i' i { $2; } | 'j' j { $2; } | 'k' k { $2; } | 'l' l { $2; } | 'm' m { $2; } | 'n' n { $2; } | 'o' o { $2; } ; a: INT | INT { } INT { } INT { }; b: INT | %empty; c: INT | INT { $1; } INT { $2; } INT { $4; }; d: INT | INT { } INT { $1; } INT { $2; }; e: INT | INT { } INT { } INT { $1; }; f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; g: INT | INT { $$; } INT { $$; } INT { }; h: INT | INT { $$; } INT { $$ = $2; } INT { }; i: INT | INT INT { } { $$ = $1 + $2; }; j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; k: INT | INT INT { $$; } { $$ = $3; } { }; l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; m: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; n: INT | INT { } INT { } INT { }; o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:775: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:775" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:775: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:775" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:775: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:775" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:12.10-32: warning: unset value: \$\$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: \$1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: \$3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: \$5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.10-62: warning: unset value: \$\$ [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: \$3 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:14.43-45: warning: unused value: \$5 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:15.10-49: warning: unset value: \$\$ [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: \$3 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:15.30-32: warning: unused value: \$5 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:16.10-37: warning: unset value: \$\$ [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: \$3 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:16.27-29: warning: unused value: \$5 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:18.10-58: warning: unset value: \$\$ [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: \$1 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.31-33: warning: unused value: \$3 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.52-54: warning: unused value: \$5 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: \$\$ [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: \$1 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: \$3 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.66-68: warning: unused value: \$5 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:22.10-68: warning: unset value: \$\$ [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: \$1 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:22.14-16: warning: unused value: \$2 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:25.23-25: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: \$1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: \$2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: \$3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: \$4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: \$5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ input.y:26.40-42: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:12.10-32: warning: unset value: $$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: $1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: $3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: $5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.10-62: warning: unset value: $$ [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: $3 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:14.43-45: warning: unused value: $5 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:15.10-49: warning: unset value: $$ [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: $3 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:15.30-32: warning: unused value: $5 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:16.10-37: warning: unset value: $$ [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: $3 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:16.27-29: warning: unused value: $5 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:18.10-58: warning: unset value: $$ [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: $1 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.31-33: warning: unused value: $3 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.52-54: warning: unused value: $5 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: $$ [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: $1 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: $3 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.66-68: warning: unused value: $5 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:22.10-68: warning: unset value: $$ [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: $1 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:22.14-16: warning: unused value: $2 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:25.23-25: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: $1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: $2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: $3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: $4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: $5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ input.y:26.40-42: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:775: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:775" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:775" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %token INT; %type a b c d e f g h i j k l m n o; %destructor { destroy ($$); } ; %% start: 'a' a { $2; } | 'b' b { $2; } | 'c' c { $2; } | 'd' d { $2; } | 'e' e { $2; } | 'f' f { $2; } | 'g' g { $2; } | 'h' h { $2; } | 'i' i { $2; } | 'j' j { $2; } | 'k' k { $2; } | 'l' l { $2; } | 'm' m { $2; } | 'n' n { $2; } | 'o' o { $2; } ; a: INT | INT { } INT { } INT { }; b: INT | %empty; c: INT | INT { $1; } INT { $2; } INT { $4; }; d: INT | INT { } INT { $1; } INT { $2; }; e: INT | INT { } INT { } INT { $1; }; f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; g: INT | INT { $$; } INT { $$; } INT { }; h: INT | INT { $$; } INT { $$ = $2; } INT { }; i: INT | INT INT { } { $$ = $1 + $2; }; j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; k: INT | INT INT { $$; } { $$ = $3; } { }; l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; m: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; n: INT | INT { } INT { } INT { }; o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --warnings=midrule-values -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --warnings=midrule-values -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --warnings=midrule-values -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --warnings=midrule-values -fcaret input.y" "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --warnings=midrule-values -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:776: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:776" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:776: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:776" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:776: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:776" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y" at_fn_check_prepare_trace "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:12.10-32: warning: unset value: \$\$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: \$1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: \$3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: \$5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.14-20: warning: unset value: \$\$ [-Wmidrule-values] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~ input.y:14.26-41: warning: unset value: \$\$ [-Wmidrule-values] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~~~~~~~~~~ input.y:14.10-62: warning: unset value: \$\$ [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: \$3 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:14.43-45: warning: unused value: \$5 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:15.14-16: warning: unset value: \$\$ [-Wmidrule-values] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:15.10-49: warning: unset value: \$\$ [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: \$3 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:15.30-32: warning: unused value: \$5 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:16.10-37: warning: unset value: \$\$ [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: \$3 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:16.27-29: warning: unused value: \$5 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:18.10-58: warning: unset value: \$\$ [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: \$1 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.14-29: warning: unused value: \$2 [-Wmidrule-values] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.31-33: warning: unused value: \$3 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.35-50: warning: unused value: \$4 [-Wmidrule-values] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.52-54: warning: unused value: \$5 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: \$\$ [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: \$1 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: \$3 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.35-64: warning: unused value: \$4 [-Wmidrule-values] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.66-68: warning: unused value: \$5 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:21.18-37: warning: unused value: \$3 [-Wmidrule-values] 21 | j: INT | INT INT { \$\$ = 1; } { \$\$ = \$1 + \$2; }; | ^~~~~~~~~~~~~~~~~~~~ input.y:22.10-68: warning: unset value: \$\$ [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: \$1 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:22.14-16: warning: unused value: \$2 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:22.35-64: warning: unused value: \$4 [-Wmidrule-values] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.23-25: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: \$1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: \$2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: \$3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: \$4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: \$5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ input.y:26.40-42: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Werror" "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:12.10-32: warning: unset value: $$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: $1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: $3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: $5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.14-20: warning: unset value: $$ [-Wmidrule-values] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~ input.y:14.26-41: warning: unset value: $$ [-Wmidrule-values] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~~~~~~~~~~ input.y:14.10-62: warning: unset value: $$ [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: $3 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:14.43-45: warning: unused value: $5 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:15.14-16: warning: unset value: $$ [-Wmidrule-values] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:15.10-49: warning: unset value: $$ [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: $3 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:15.30-32: warning: unused value: $5 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:16.10-37: warning: unset value: $$ [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: $3 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:16.27-29: warning: unused value: $5 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:18.10-58: warning: unset value: $$ [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: $1 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.14-29: warning: unused value: $2 [-Wmidrule-values] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.31-33: warning: unused value: $3 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.35-50: warning: unused value: $4 [-Wmidrule-values] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.52-54: warning: unused value: $5 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: $$ [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: $1 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: $3 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.35-64: warning: unused value: $4 [-Wmidrule-values] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.66-68: warning: unused value: $5 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:21.18-37: warning: unused value: $3 [-Wmidrule-values] 21 | j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; | ^~~~~~~~~~~~~~~~~~~~ input.y:22.10-68: warning: unset value: $$ [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: $1 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:22.14-16: warning: unused value: $2 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:22.35-64: warning: unused value: $4 [-Wmidrule-values] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.23-25: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: $1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: $2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: $3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: $4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: $5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ input.y:26.40-42: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:776: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:776" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=error" "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:776: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=none -Werror --trace=none" "input.at:776" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:776" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_15 #AT_START_16 at_fn_group_banner 16 'input.at:784' \ "Unused values before symbol declarations" " " 2 at_xfail=no ( printf "%s\n" "16. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% start: 'a' a { $2; } | 'b' b { $2; } | 'c' c { $2; } | 'd' d { $2; } | 'e' e { $2; } | 'f' f { $2; } | 'g' g { $2; } | 'h' h { $2; } | 'i' i { $2; } | 'j' j { $2; } | 'k' k { $2; } | 'l' l { $2; } | 'm' m { $2; } | 'n' n { $2; } | 'o' o { $2; } ; a: INT | INT { } INT { } INT { }; b: INT | %empty; c: INT | INT { $1; } INT { $2; } INT { $4; }; d: INT | INT { } INT { $1; } INT { $2; }; e: INT | INT { } INT { } INT { $1; }; f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; g: INT | INT { $$; } INT { $$; } INT { }; h: INT | INT { $$; } INT { $$ = $2; } INT { }; i: INT | INT INT { } { $$ = $1 + $2; }; j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; k: INT | INT INT { $$; } { $$ = $3; } { }; l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; m: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; n: INT | INT { } INT { } INT { }; o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; %token INT; %type a b c d e f g h i j k l m n o; %destructor { destroy ($$); } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:785: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:785" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:785: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:785" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:785: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:785" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:12.10-32: warning: unset value: \$\$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: \$1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: \$3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: \$5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.10-62: warning: unset value: \$\$ [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: \$3 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:14.43-45: warning: unused value: \$5 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:15.10-49: warning: unset value: \$\$ [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: \$3 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:15.30-32: warning: unused value: \$5 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:16.10-37: warning: unset value: \$\$ [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: \$3 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:16.27-29: warning: unused value: \$5 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:18.10-58: warning: unset value: \$\$ [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: \$1 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.31-33: warning: unused value: \$3 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.52-54: warning: unused value: \$5 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: \$\$ [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: \$1 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: \$3 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.66-68: warning: unused value: \$5 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:22.10-68: warning: unset value: \$\$ [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: \$1 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:22.14-16: warning: unused value: \$2 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:25.23-25: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: \$1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: \$2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: \$3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: \$4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: \$5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ input.y:26.40-42: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:12.10-32: warning: unset value: $$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: $1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: $3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: $5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.10-62: warning: unset value: $$ [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: $3 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:14.43-45: warning: unused value: $5 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:15.10-49: warning: unset value: $$ [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: $3 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:15.30-32: warning: unused value: $5 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:16.10-37: warning: unset value: $$ [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: $3 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:16.27-29: warning: unused value: $5 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:18.10-58: warning: unset value: $$ [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: $1 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.31-33: warning: unused value: $3 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.52-54: warning: unused value: $5 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: $$ [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: $1 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: $3 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.66-68: warning: unused value: $5 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:22.10-68: warning: unset value: $$ [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: $1 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:22.14-16: warning: unused value: $2 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:25.23-25: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: $1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: $2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: $3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: $4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: $5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ input.y:26.40-42: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:785: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:785" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:785" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %% start: 'a' a { $2; } | 'b' b { $2; } | 'c' c { $2; } | 'd' d { $2; } | 'e' e { $2; } | 'f' f { $2; } | 'g' g { $2; } | 'h' h { $2; } | 'i' i { $2; } | 'j' j { $2; } | 'k' k { $2; } | 'l' l { $2; } | 'm' m { $2; } | 'n' n { $2; } | 'o' o { $2; } ; a: INT | INT { } INT { } INT { }; b: INT | %empty; c: INT | INT { $1; } INT { $2; } INT { $4; }; d: INT | INT { } INT { $1; } INT { $2; }; e: INT | INT { } INT { } INT { $1; }; f: INT | INT { } INT { } INT { $$ = $1 + $3 + $5; }; g: INT | INT { $$; } INT { $$; } INT { }; h: INT | INT { $$; } INT { $$ = $2; } INT { }; i: INT | INT INT { } { $$ = $1 + $2; }; j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; k: INT | INT INT { $$; } { $$ = $3; } { }; l: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; m: INT | INT { $$ = $1; } INT { $$ = $2 + $3; } INT { $$ = $4 + $5; }; n: INT | INT { } INT { } INT { }; o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; %token INT; %type a b c d e f g h i j k l m n o; %destructor { destroy ($$); } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --warnings=midrule-values -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --warnings=midrule-values -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --warnings=midrule-values -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --warnings=midrule-values -fcaret input.y" "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --warnings=midrule-values -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:786: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:786" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:786: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:786" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:786: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:786" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y" at_fn_check_prepare_trace "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:12.10-32: warning: unset value: \$\$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: \$1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: \$3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: \$5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.14-20: warning: unset value: \$\$ [-Wmidrule-values] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~ input.y:14.26-41: warning: unset value: \$\$ [-Wmidrule-values] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~~~~~~~~~~ input.y:14.10-62: warning: unset value: \$\$ [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: \$3 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:14.43-45: warning: unused value: \$5 [-Wother] 14 | c: INT | INT { \$1; } INT { \$2; } INT { \$4; }; | ^~~ input.y:15.14-16: warning: unset value: \$\$ [-Wmidrule-values] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:15.10-49: warning: unset value: \$\$ [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: \$3 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:15.30-32: warning: unused value: \$5 [-Wother] 15 | d: INT | INT { } INT { \$1; } INT { \$2; }; | ^~~ input.y:16.10-37: warning: unset value: \$\$ [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: \$3 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:16.27-29: warning: unused value: \$5 [-Wother] 16 | e: INT | INT { } INT { } INT { \$1; }; | ^~~ input.y:18.10-58: warning: unset value: \$\$ [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: \$1 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.14-29: warning: unused value: \$2 [-Wmidrule-values] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.31-33: warning: unused value: \$3 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:18.35-50: warning: unused value: \$4 [-Wmidrule-values] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.52-54: warning: unused value: \$5 [-Wother] 18 | g: INT | INT { \$\$; } INT { \$\$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: \$\$ [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: \$1 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: \$3 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:19.35-64: warning: unused value: \$4 [-Wmidrule-values] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.66-68: warning: unused value: \$5 [-Wother] 19 | h: INT | INT { \$\$; } INT { \$\$ = \$2; } INT { }; | ^~~ input.y:21.18-37: warning: unused value: \$3 [-Wmidrule-values] 21 | j: INT | INT INT { \$\$ = 1; } { \$\$ = \$1 + \$2; }; | ^~~~~~~~~~~~~~~~~~~~ input.y:22.10-68: warning: unset value: \$\$ [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: \$1 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:22.14-16: warning: unused value: \$2 [-Wother] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~ input.y:22.35-64: warning: unused value: \$4 [-Wmidrule-values] 22 | k: INT | INT INT { \$\$; } { \$\$ = \$3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.23-25: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: \$\$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: \$1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: \$2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: \$3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: \$4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: \$5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ input.y:26.40-42: warning: unset value: \$\$ [-Wother] 26 | o: INT | INT { } INT { } INT { \$\$ = \$1 + \$2 + \$3 + \$4 + \$5; }; | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Werror" "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:12.10-32: warning: unset value: $$ [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~ input.y:12.10-12: warning: unused value: $1 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.18-20: warning: unused value: $3 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:12.26-28: warning: unused value: $5 [-Wother] 12 | a: INT | INT { } INT { } INT { }; | ^~~ input.y:13.10-15: warning: empty rule for typed nonterminal, and no action [-Wother] 13 | b: INT | %empty; | ^~~~~~ input.y:14.14-20: warning: unset value: $$ [-Wmidrule-values] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~ input.y:14.26-41: warning: unset value: $$ [-Wmidrule-values] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~~~~~~~~~~ input.y:14.10-62: warning: unset value: $$ [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:14.22-24: warning: unused value: $3 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:14.43-45: warning: unused value: $5 [-Wother] 14 | c: INT | INT { $1; } INT { $2; } INT { $4; }; | ^~~ input.y:15.14-16: warning: unset value: $$ [-Wmidrule-values] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:15.10-49: warning: unset value: $$ [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:15.18-20: warning: unused value: $3 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:15.30-32: warning: unused value: $5 [-Wother] 15 | d: INT | INT { } INT { $1; } INT { $2; }; | ^~~ input.y:16.10-37: warning: unset value: $$ [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:16.18-20: warning: unused value: $3 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:16.27-29: warning: unused value: $5 [-Wother] 16 | e: INT | INT { } INT { } INT { $1; }; | ^~~ input.y:18.10-58: warning: unset value: $$ [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:18.10-12: warning: unused value: $1 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.14-29: warning: unused value: $2 [-Wmidrule-values] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.31-33: warning: unused value: $3 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:18.35-50: warning: unused value: $4 [-Wmidrule-values] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~~~~~~~~~~~~~~ input.y:18.52-54: warning: unused value: $5 [-Wother] 18 | g: INT | INT { $$; } INT { $$; } INT { }; | ^~~ input.y:19.10-72: warning: unset value: $$ [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.10-12: warning: unused value: $1 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.31-33: warning: unused value: $3 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:19.35-64: warning: unused value: $4 [-Wmidrule-values] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:19.66-68: warning: unused value: $5 [-Wother] 19 | h: INT | INT { $$; } INT { $$ = $2; } INT { }; | ^~~ input.y:21.18-37: warning: unused value: $3 [-Wmidrule-values] 21 | j: INT | INT INT { $$ = 1; } { $$ = $1 + $2; }; | ^~~~~~~~~~~~~~~~~~~~ input.y:22.10-68: warning: unset value: $$ [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:22.10-12: warning: unused value: $1 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:22.14-16: warning: unused value: $2 [-Wother] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~ input.y:22.35-64: warning: unused value: $4 [-Wmidrule-values] 22 | k: INT | INT INT { $$; } { $$ = $3; } { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.23-25: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.10-50: warning: unset value: $$ [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:25.10-12: warning: unused value: $1 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.23-25: warning: unused value: $2 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.27-29: warning: unused value: $3 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.40-42: warning: unused value: $4 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:25.44-46: warning: unused value: $5 [-Wother] 25 | n: INT | INT { } INT { } INT { }; | ^~~ input.y:26.23-25: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ input.y:26.40-42: warning: unset value: $$ [-Wother] 26 | o: INT | INT { } INT { } INT { $$ = $1 + $2 + $3 + $4 + $5; }; | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:786: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:786" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=error" "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=none -Werror --trace=none" "input.at:786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --warnings=midrule-values -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:786" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_16 #AT_START_17 at_fn_group_banner 17 'input.at:794' \ "Symbol redeclared" " " 2 at_xfail=no ( printf "%s\n" "17. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token FOO FOO %token BAR 12 BAR 12 %token EOF 0 EOF 0 %% exp: FOO BAR _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:804: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:804" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:804: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:804" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:804: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:804" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.12-14: warning: symbol FOO redeclared [-Wother] 1 | %token FOO FOO | ^~~ input.y:1.8-10: note: previous declaration 1 | %token FOO FOO | ^~~ input.y:2.15-17: warning: symbol BAR redeclared [-Wother] 2 | %token BAR 12 BAR 12 | ^~~ input.y:2.8-10: note: previous declaration 2 | %token BAR 12 BAR 12 | ^~~ input.y:3.14-16: warning: symbol EOF redeclared [-Wother] 3 | %token EOF 0 EOF 0 | ^~~ input.y:3.8-10: note: previous declaration 3 | %token EOF 0 EOF 0 | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.12-14: warning: symbol FOO redeclared [-Wother] 1 | %token FOO FOO | ^~~ input.y:1.8-10: note: previous declaration 1 | %token FOO FOO | ^~~ input.y:2.15-17: warning: symbol BAR redeclared [-Wother] 2 | %token BAR 12 BAR 12 | ^~~ input.y:2.8-10: note: previous declaration 2 | %token BAR 12 BAR 12 | ^~~ input.y:3.14-16: warning: symbol EOF redeclared [-Wother] 3 | %token EOF 0 EOF 0 | ^~~ input.y:3.8-10: note: previous declaration 3 | %token EOF 0 EOF 0 | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:804: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:804" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:804: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:804" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:804" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_17 #AT_START_18 at_fn_group_banner 18 'input.at:832' \ "EOF redeclared" " " 2 at_xfail=no ( printf "%s\n" "18. $at_setup_line: testing $at_desc ..." $at_traceon # We used to crash when redefining a token after having defined EOF. # See https://lists.gnu.org/r/bug-bison/2020-08/msg00008.html. cat >input.y <<'_ATEOF' %token FOO BAR FOO 0 %% input: %empty _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:843: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:843" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:843: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:843" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:843: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:843" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.16-18: warning: symbol FOO redeclared [-Wother] 1 | %token FOO BAR FOO 0 | ^~~ input.y:1.8-10: note: previous declaration 1 | %token FOO BAR FOO 0 | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.16-18: warning: symbol FOO redeclared [-Wother] 1 | %token FOO BAR FOO 0 | ^~~ input.y:1.8-10: note: previous declaration 1 | %token FOO BAR FOO 0 | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:843: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:843" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:843" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_18 #AT_START_19 at_fn_group_banner 19 'input.at:859' \ "Symbol class redefinition" " " 2 at_xfail=no ( printf "%s\n" "19. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token FOO %nterm FOO BAR %token BAR %nterm error // The token error cannot be redefined as an nterm. %% FOO: BAR BAR: _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:871: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:871" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-10: error: symbol FOO redeclared as a nonterminal 2 | %nterm FOO BAR | ^~~ input.y:1.8-10: note: previous definition 1 | %token FOO | ^~~ input.y:3.8-10: error: symbol BAR redeclared as a token 3 | %token BAR | ^~~ input.y:2.12-14: note: previous definition 2 | %nterm FOO BAR | ^~~ input.y:4.8-12: error: symbol error redeclared as a nonterminal 4 | %nterm error // The token error cannot be redefined as an nterm. | ^~~~~ input.y:6.1-3: error: rule given for FOO, which is a token 6 | FOO: BAR | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:871" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_19 #AT_START_20 at_fn_group_banner 20 'input.at:899' \ "Default %printer and %destructor redeclared" " " 2 at_xfail=no ( printf "%s\n" "20. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST([*]) # ------------ cat >input.y <<'_ATEOF' %destructor { destroy ($$); } <> <> %printer { print ($$); } <> <> %destructor { destroy ($$); } <> %printer { print ($$); } <> %% start: %empty; %destructor { destroy ($$); } <>; %printer { print ($$); } <>; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.13-29: error: %destructor redeclaration for <> 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:1.13-29: note: previous declaration 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:2.10-24: error: %printer redeclaration for <> 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ input.y:2.10-24: note: previous declaration 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ input.y:4.13-29: error: %destructor redeclaration for <> 4 | %destructor { destroy (\$\$); } <> | ^~~~~~~~~~~~~~~~~ input.y:1.13-29: note: previous declaration 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:5.10-24: error: %printer redeclaration for <> 5 | %printer { print (\$\$); } <> | ^~~~~~~~~~~~~~~ input.y:2.10-24: note: previous declaration 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ input.y:11.13-29: error: %destructor redeclaration for <> 11 | %destructor { destroy (\$\$); } <>; | ^~~~~~~~~~~~~~~~~ input.y:1.13-29: note: previous declaration 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:12.10-24: error: %printer redeclaration for <> 12 | %printer { print (\$\$); } <>; | ^~~~~~~~~~~~~~~ input.y:2.10-24: note: previous declaration 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:959" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %destructor { destroy ($$); } <> <> %printer { print ($$); } <> <> %destructor { destroy ($$); } <> %printer { print ($$); } <> %% start: %empty; %destructor { destroy ($$); } <>; %printer { print ($$); } <>; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:960: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:960" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.13-29: error: %destructor redeclaration for <> 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:1.13-29: note: previous declaration 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:2.10-24: error: %printer redeclaration for <> 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ input.y:2.10-24: note: previous declaration 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ input.y:4.13-29: error: %destructor redeclaration for <> 4 | %destructor { destroy (\$\$); } <> | ^~~~~~~~~~~~~~~~~ input.y:1.13-29: note: previous declaration 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:5.10-24: error: %printer redeclaration for <> 5 | %printer { print (\$\$); } <> | ^~~~~~~~~~~~~~~ input.y:2.10-24: note: previous declaration 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ input.y:11.13-29: error: %destructor redeclaration for <> 11 | %destructor { destroy (\$\$); } <>; | ^~~~~~~~~~~~~~~~~ input.y:1.13-29: note: previous declaration 1 | %destructor { destroy (\$\$); } <> <> | ^~~~~~~~~~~~~~~~~ input.y:12.10-24: error: %printer redeclaration for <> 12 | %printer { print (\$\$); } <>; | ^~~~~~~~~~~~~~~ input.y:2.10-24: note: previous declaration 2 | %printer { print (\$\$); } <> <> | ^~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:960" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_20 #AT_START_21 at_fn_group_banner 21 'input.at:970' \ "Per-type %printer and %destructor redeclared" " " 2 at_xfail=no ( printf "%s\n" "21. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %destructor { destroy ($$); } %printer { print ($$); } %destructor { destroy ($$); } %printer { print ($$); } %% start: %empty; %destructor { destroy ($$); } ; %printer { print ($$); } ; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:987: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:987" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:4.13-29: error: %destructor redeclaration for input.y:1.13-29: note: previous declaration input.y:4.13-29: error: %destructor redeclaration for input.y:1.13-29: note: previous declaration input.y:5.10-24: error: %printer redeclaration for input.y:2.10-24: note: previous declaration input.y:5.10-24: error: %printer redeclaration for input.y:2.10-24: note: previous declaration input.y:11.13-29: error: %destructor redeclaration for input.y:1.13-29: note: previous declaration input.y:11.13-29: error: %destructor redeclaration for input.y:1.13-29: note: previous declaration input.y:12.10-24: error: %printer redeclaration for input.y:2.10-24: note: previous declaration input.y:12.10-24: error: %printer redeclaration for input.y:2.10-24: note: previous declaration " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:987" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_21 #AT_START_22 at_fn_group_banner 22 'input.at:1013' \ "Undefined symbols" " " 2 at_xfail=no ( printf "%s\n" "22. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %printer {} foo baz %destructor {} bar %type qux %% exp: bar; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1023: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1023" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.13-15: warning: symbol 'foo' is used, but is not defined as a token and has no rules [-Wother] 1 | %printer {} foo baz | ^~~ input.y:1.17-19: warning: symbol 'baz' is used, but is not defined as a token and has no rules [-Wother] 1 | %printer {} foo baz | ^~~ input.y:2.16-18: error: symbol 'bar' is used, but is not defined as a token and has no rules 2 | %destructor {} bar | ^~~ input.y:3.13-15: warning: symbol 'qux' is used, but is not defined as a token and has no rules [-Wother] 3 | %type qux | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1023" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_22 #AT_START_23 at_fn_group_banner 23 'input.at:1045' \ "Unassociated types used for a printer or destructor" "" 2 at_xfail=no ( printf "%s\n" "23. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token tag1 %type tag2 %printer { } %destructor { } %% exp: tag1 { $1; } | tag2 { $1; } tag2: "a" { $$; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1062: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1062" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1062: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1062" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1062: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1062" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:4.22-28: warning: type is used, but is not associated to any symbol [-Wother] input.y:5.25-31: warning: type is used, but is not associated to any symbol [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:4.22-28: warning: type is used, but is not associated to any symbol [-Wother] input.y:5.25-31: warning: type is used, but is not associated to any symbol [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1062: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1062" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:1062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1062" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_23 #AT_START_24 at_fn_group_banner 24 'input.at:1074' \ "Useless printers or destructors" " " 2 at_xfail=no ( printf "%s\n" "24. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST([INPUT], [STDERR]) # -------------------------- cat >input.y <<'_ATEOF' %token token1 %token token2 %token token3 %token token4 %token token51 token52 %token token61 token62 %token token7 %printer {} token1 %destructor {} token2 %printer {} token51 %destructor {} token61 %printer {} token7 %printer {} %destructor {} %printer {} %destructor {} %printer {} %destructor {} %destructor {} %% exp: "a"; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1085: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1085" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1085: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1085" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1085: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1085" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:16.13-19: warning: useless %printer for type [-Wother] input.y:17.16-22: warning: useless %destructor for type [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:16.13-19: warning: useless %printer for type [-Wother] input.y:17.16-22: warning: useless %destructor for type [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1085: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1085" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1085: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:1085" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1085" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # If everybody is typed, <> is useless. cat >input.y <<'_ATEOF' %type exp %token a %printer {} <> <*> %% exp: a; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1116: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1116" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1116: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1116" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1116: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1116" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.13-14: warning: useless %printer for type <> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:3.13-14: warning: useless %printer for type <> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1116: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1116" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1116" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # If nobody is typed, <*> is useless. cat >input.y <<'_ATEOF' %token a %printer {} <> <*> %% exp: a; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1124: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1124" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1124: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1124" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1124: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1124" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.16-18: warning: useless %printer for type <*> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.16-18: warning: useless %printer for type <*> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1124: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1124" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1124: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:1124" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1124" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_24 #AT_START_25 at_fn_group_banner 25 'input.at:1139' \ "Unused values with default %destructor" " " 2 at_xfail=no ( printf "%s\n" "25. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %destructor { destroy ($$); } <> %type tagged %% start: end end tagged tagged { $1; $3; } ; end: { } ; tagged: { } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1152: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1152" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1152: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1152" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1152: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1152" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:6.8-45: warning: unset value: \$\$ [-Wother] 6 | start: end end tagged tagged { \$1; \$3; } ; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:6.12-14: warning: unused value: \$2 [-Wother] 6 | start: end end tagged tagged { \$1; \$3; } ; | ^~~ input.y:7.6-8: warning: unset value: \$\$ [-Wother] 7 | end: { } ; | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:6.8-45: warning: unset value: $$ [-Wother] 6 | start: end end tagged tagged { $1; $3; } ; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:6.12-14: warning: unused value: $2 [-Wother] 6 | start: end end tagged tagged { $1; $3; } ; | ^~~ input.y:7.6-8: warning: unset value: $$ [-Wother] 7 | end: { } ; | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1152: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1152" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1152: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:1152" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1152" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %destructor { destroy ($$); } <*> %type tagged %% start: end end tagged tagged { $1; $3; } ; end: { } ; tagged: { } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1175: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1175" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1175: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1175" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1175: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1175" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:6.23-28: warning: unused value: \$4 [-Wother] input.y:8.9-11: warning: unset value: \$\$ [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:6.23-28: warning: unused value: $4 [-Wother] input.y:8.9-11: warning: unset value: $$ [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1175: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1175" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1175" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_25 #AT_START_26 at_fn_group_banner 26 'input.at:1187' \ "Unused values with per-type %destructor" " " 2 at_xfail=no ( printf "%s\n" "26. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %destructor { destroy ($$); } %type start end %% start: end end { $1; } ; end: { } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1199: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1199" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1199: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1199" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1199: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1199" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:6.8-22: warning: unset value: \$\$ [-Wother] 6 | start: end end { \$1; } ; | ^~~~~~~~~~~~~~~ input.y:6.12-14: warning: unused value: \$2 [-Wother] 6 | start: end end { \$1; } ; | ^~~ input.y:7.6-8: warning: unset value: \$\$ [-Wother] 7 | end: { } ; | ^~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:6.8-22: warning: unset value: $$ [-Wother] 6 | start: end end { $1; } ; | ^~~~~~~~~~~~~~~ input.y:6.12-14: warning: unused value: $2 [-Wother] 6 | start: end end { $1; } ; | ^~~ input.y:7.6-8: warning: unset value: $$ [-Wother] 7 | end: { } ; | ^~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1199: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1199" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:1199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1199" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_26 #AT_START_27 at_fn_group_banner 27 'input.at:1219' \ "Duplicate string" " " 2 at_xfail=no ( printf "%s\n" "27. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' /* 'Bison -v' used to dump core when two tokens are defined with the same string, as LE and GE below. */ %token NUM %token LE "<=" %token GE "<=" %% exp: '(' exp ')' | NUM ; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1236: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1236" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1236: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1236" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1236: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1236" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y" at_fn_check_prepare_trace "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:6.11-14: warning: symbol \"<=\" used more than once as a literal string [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y -Werror" "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:6.11-14: warning: symbol "<=" used more than once as a literal string [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1236: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1236" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y --warnings=error" "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y -Wnone,none -Werror --trace=none" "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y --warnings=none -Werror --trace=none" "input.at:1236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1236" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_27 #AT_START_28 at_fn_group_banner 28 'input.at:1247' \ "Token collisions" " " 2 at_xfail=no ( printf "%s\n" "28. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token FOO 42 "foo" BAR 42 "foo" %% exp: FOO BAR; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1256: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1256" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.17-21: warning: symbol \"foo\" used more than once as a literal string [-Wother] 2 | BAR 42 \"foo\" | ^~~~~ input.y:2.10-12: error: code 42 reassigned to token BAR 2 | BAR 42 \"foo\" | ^~~ input.y:1.15-19: note: previous declaration for \"foo\" 1 | %token FOO 42 \"foo\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1256" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_28 #AT_START_29 at_fn_group_banner 29 'input.at:1275' \ "Incompatible Aliases" " " 2 at_xfail=no ( printf "%s\n" "29. $at_setup_line: testing $at_desc ..." $at_traceon # Use the string-alias first to check the order between "first # declaration" and second. cat >input.y <<'_ATEOF' %token foo "foo" %type "foo" %type foo %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1285: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1285" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.13-15: error: %type redeclaration for foo 3 | %type foo | ^~~ input.y:2.13-17: note: previous declaration 2 | %type \"foo\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1285" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %token foo "foo" %printer {bar} "foo" %printer {baz} foo %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1299: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1299" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.10-14: error: %printer redeclaration for foo 3 | %printer {baz} foo | ^~~~~ input.y:2.10-14: note: previous declaration 2 | %printer {bar} \"foo\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1299" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %token foo "foo" %destructor {bar} "foo" %destructor {baz} foo %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1313: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1313" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.13-17: error: %destructor redeclaration for foo 3 | %destructor {baz} foo | ^~~~~ input.y:2.13-17: note: previous declaration 2 | %destructor {bar} \"foo\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1313" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %token foo "foo" %left "foo" %left foo %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-5: error: %left redeclaration for foo 3 | %left foo | ^~~~~ input.y:2.1-5: note: previous declaration 2 | %left \"foo\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1327" $at_failed && at_fn_log_failure $at_traceon; } # This time, declare the alias after its use. # Precedence/associativity. cat >input.y <<'_ATEOF' %left "foo" %left foo %token foo "foo" %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1344: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1344" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-5: error: %left redeclaration for foo 2 | %left foo | ^~~~~ input.y:1.1-5: note: previous declaration 1 | %left \"foo\" | ^~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Printer. cat >input.y <<'_ATEOF' %printer {} "foo" %printer {} foo %token foo "foo" %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.10-11: error: %printer redeclaration for foo 2 | %printer {} foo | ^~ input.y:1.10-11: note: previous declaration 1 | %printer {} \"foo\" | ^~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1359" $at_failed && at_fn_log_failure $at_traceon; } # Destructor. cat >input.y <<'_ATEOF' %destructor {} "foo" %destructor {} foo %token foo "foo" %% exp: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.13-14: error: %destructor redeclaration for foo 2 | %destructor {} foo | ^~ input.y:1.13-14: note: previous declaration 1 | %destructor {} \"foo\" | ^~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1374" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_29 #AT_START_30 at_fn_group_banner 30 'input.at:1400' \ "Torturing the Scanner" " " 2 at_xfail=no ( printf "%s\n" "30. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' {} _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1407: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:1407" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-2: error: unexpected {...} 1 | {} | ^~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Clang chokes on some of our comments, because it tries to "parse" # some documentation directives in the comments: # # input.c:166:50: error: '\a' command does not have a valid word argument [-Werror,-Wdocumentation] # FAKE = 258 /* "fake [] \a\b\f\n\r\t\v\"'?\\[\\ ??!??'??(??)??-??/?? \001\001" */ # ~~^ cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #if defined __clang__ && 10 <= __clang_major__ # pragma clang diagnostic ignored "-Wdocumentation" #endif } %{ /* This is seen in GCC: a %{ and %} in middle of a comment. */ const char *foo = "So %{ and %} can be here too."; #if 0 /* These examples test Bison while not stressing C compilers too much. Many C compilers mishandle backslash-newlines, so this part of the test is inside "#if 0". The comment and string are written so that the "#endif" will be seen regardless of the C compiler bugs that we know about, namely: HP C (as of late 2002) mishandles *\[newline]\[newline]/ within a comment. The Apple Darwin compiler (as of late 2002) mishandles \\[newline]' within a character constant. */ /\ * A comment with backslash-newlines in it. %} *\ \ / /* { Close the above comment, if the C compiler mishandled it. */ char str[] = "\\ " A string with backslash-newlines in it %{ %} \\ \ ""; char apostrophe = '\''; #endif #include #include #include %} /* %{ and %} can be here too. */ %{ /* Exercise pre-prologue dependency to %union. */ typedef int value; %} /* Exercise M4 quoting: ']]', 0. */ /* Also exercise %union. */ %union { value ival; /* A comment to exercise an old bug. */ }; /* Exercise post-prologue dependency to %union. */ %{ static YYSTYPE value_as_yystype (value val); /* Exercise quotes in declarations. */ char quote[] = "]],"; %} %{ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %type '[' /* Exercise quotes in strings. */ %token FAKE "fake [] \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/?? \x1\1" /* Beware of the generated comments that embed string aliases that might close the comment. */ %token COMMENT_CLOSE "*/" %token COMMENT "/* comment */" %% /* Exercise M4 quoting: ']]', [, 1. */ exp: '[' '\1' two '$' '@' '{' oline output.or.oline.opt { /* Exercise quotes in braces. */ char tmp[] = "[%c],\n"; printf (tmp, $1); } ; two: '\x000000000000000000000000000000000000000000000000000000000000000000002'; oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_'; output.or.oline.opt: %empty;|oline;;|output;;; output: '#' 'o' 'u' 't' 'p' 'u' 't' ' '; %% /* Exercise M4 quoting: ']]', [, 2. */ static YYSTYPE value_as_yystype (value val) { YYSTYPE res; res.ival = val; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static char const input[] = "[\1\2$@{@oline@__oline__\ #output "; /* " */ enum { input_elts = sizeof input }; (void) input_elts; static int toknum; assert (0 <= toknum && toknum < input_elts); yylval = value_as_yystype (input[toknum]); return input[toknum++]; } _ATEOF # Pacify Emacs'font-lock-mode: " cat >main.c <<'_ATEOF' typedef int value; #include "input.h" int yyparse (void); #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1554: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1554" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1554" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1554: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" "input.at:1554" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1554: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1554" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1554: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1554" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1554" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1554: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1554" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1554" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1554: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y" at_fn_check_prepare_trace "input.at:1554" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1554" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "input.at:1555" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/input.at:1555" { set +x printf "%s\n" "$at_srcdir/input.at:1555: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "input.at:1555" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1555" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "input.at:1556" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/input.at:1556" { set +x printf "%s\n" "$at_srcdir/input.at:1556: \$CC \$CFLAGS \$CPPFLAGS -c -o main.o main.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o main.o main.c " "input.at:1556" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o main.o main.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1556" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "input.at:1557" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/input.at:1557" { set +x printf "%s\n" "$at_srcdir/input.at:1557: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.o main.o \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.o main.o $LIBS" "input.at:1557" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.o main.o $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1557" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1558: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "input.at:1558" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "[[], " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1558" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1558: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "input.at:1558" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1558" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_30 #AT_START_31 at_fn_group_banner 31 'input.at:1569' \ "Typed symbol aliases" " " 2 at_xfail=no ( printf "%s\n" "31. $at_setup_line: testing $at_desc ..." $at_traceon # Bison 2.0 broke typed symbol aliases - ensure they work. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %union { int val; }; %token MY_TOKEN "MY TOKEN" %type exp %% exp: "MY TOKEN"; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1586: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1586" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1586" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1586: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:1586" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1586" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1586: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1586" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1586" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1586: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1586" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1586" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1586: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1586" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1586" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1586: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:1586" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1586" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_31 #AT_START_32 at_fn_group_banner 32 'input.at:1609' \ "Require 1.0" " " 2 at_xfail=no ( printf "%s\n" "32. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %require "1.0"; %% empty_file: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1609: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1609" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1609" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1609: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:1609" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1609" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1609: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1609" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1609" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1609: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1609" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1609" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1609: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1609" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1609" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1609: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:1609" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1609" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_32 #AT_START_33 at_fn_group_banner 33 'input.at:1610' \ "Require 3.8.2" " " 2 at_xfail=no ( printf "%s\n" "33. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %require "3.8.2"; %% empty_file: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1610: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1610" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1610" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1610: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:1610" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1610" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1610: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1610" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1610" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1610: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1610" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1610" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1610: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1610" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1610" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1610: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:1610" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1610" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_33 #AT_START_34 at_fn_group_banner 34 'input.at:1612' \ "Require 100.0" " " 2 at_xfail=no ( printf "%s\n" "34. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %require "100.0"; %% empty_file: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1612: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "input.at:1612" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 63 $at_status "$at_srcdir/input.at:1612" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_34 #AT_START_35 at_fn_group_banner 35 'input.at:1619' \ "String aliases for character tokens" " " 2 at_xfail=no ( printf "%s\n" "35. $at_setup_line: testing $at_desc ..." $at_traceon # Bison once thought a character token and its alias were different # symbols with the same code. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token 'a' "a" %% start: 'a'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1632: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1632" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1632" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1632: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:1632" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1632" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1632: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1632" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1632" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1632: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1632" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1632" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1632: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1632" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1632" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1632: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:1632" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1632" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_35 #AT_START_36 at_fn_group_banner 36 'input.at:1642' \ "Symbols" " " 2 at_xfail=no ( printf "%s\n" "36. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token WITH-DASH %token WITHOUT_DASH "WITHOUT-DASH" %token WITH.PERIOD %token WITHOUT_PERIOD "WITHOUT.PERIOD" %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% start: with-dash without_dash with.period without_period; with-dash: WITH-DASH; without_dash: "WITHOUT-DASH"; with.period: WITH.PERIOD; without_period: "WITHOUT.PERIOD"; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF # POSIX Yacc accept periods, but not dashes. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --yacc input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --yacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --yacc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --yacc input.y" "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --yacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1666: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1666" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1666: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1666" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1666: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1666" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --yacc input.y" at_fn_check_prepare_trace "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --yacc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-5: warning: POSIX Yacc does not support %code [-Wyacc] input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc] input.y:10.21-34: warning: POSIX Yacc does not support string literals [-Wyacc] input.y:12.23-38: warning: POSIX Yacc does not support string literals [-Wyacc] input.y:13.1-5: warning: POSIX Yacc does not support %code [-Wyacc] input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc] input.y:22.15-28: warning: POSIX Yacc does not support string literals [-Wyacc] input.y:24.17-32: warning: POSIX Yacc does not support string literals [-Wyacc] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y -Werror" "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.1-5: warning: POSIX Yacc does not support %code [-Wyacc] input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc] input.y:10.21-34: warning: POSIX Yacc does not support string literals [-Wyacc] input.y:12.23-38: warning: POSIX Yacc does not support string literals [-Wyacc] input.y:13.1-5: warning: POSIX Yacc does not support %code [-Wyacc] input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc] input.y:22.15-28: warning: POSIX Yacc does not support string literals [-Wyacc] input.y:24.17-32: warning: POSIX Yacc does not support string literals [-Wyacc] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1666: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1666" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y --warnings=error" "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y -Wnone,none -Werror --trace=none" "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1666: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y --warnings=none -Werror --trace=none" "input.at:1666" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --yacc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1666" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # Dashes are fine for GNU Bison. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1678: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1678" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1678" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1678: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:1678" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1678" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1678: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1678" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1678" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1678: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1678" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1678" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1678: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1678" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1678" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1678: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:1678" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1678" $at_failed && at_fn_log_failure $at_traceon; } # Make sure we don't export silly token identifiers with periods or dashes. printf "%s\n" "input.at:1681" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/input.at:1681" { set +x printf "%s\n" "$at_srcdir/input.at:1681: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "input.at:1681" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1681" $at_failed && at_fn_log_failure $at_traceon; } # Periods are genuine letters, they can start identifiers. # Digits and dashes cannot. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token .GOOD -GOOD 1NV4L1D -123 %% start: .GOOD GOOD _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1694: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "input.at:1694" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:10.10: error: invalid character: '-' input.y:11.10-16: error: invalid identifier: '1NV4L1D' input.y:12.10: error: invalid character: '-' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1694" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_36 #AT_START_37 at_fn_group_banner 37 'input.at:1708' \ "Numbered tokens" " " 2 at_xfail=no ( printf "%s\n" "37. $at_setup_line: testing $at_desc ..." $at_traceon cat >redecl.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token DECIMAL_1 11259375 HEXADECIMAL_1 0xabcdef HEXADECIMAL_2 0xFEDCBA DECIMAL_2 16702650 %% start: DECIMAL_1 HEXADECIMAL_2; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1720: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret redecl.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret redecl.y" "input.at:1720" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret redecl.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "redecl.y:10.10-22: error: code 11259375 reassigned to token HEXADECIMAL_1 redecl.y:9.8-16: note: previous declaration for DECIMAL_1 redecl.y:12.10-18: error: code 16702650 reassigned to token DECIMAL_2 redecl.y:11.10-22: note: previous declaration for HEXADECIMAL_2 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1720" $at_failed && at_fn_log_failure $at_traceon; } cat >too-large.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token TOO_LARGE_DEC 999999999999999999999 TOO_LARGE_HEX 0xFFFFFFFFFFFFFFFFFFF %% start: TOO_LARGE_DEC TOO_LARGE_HEX %% _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1735: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret too-large.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret too-large.y" "input.at:1735" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret too-large.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "too-large.y:9.22-42: error: integer out of range: '999999999999999999999' too-large.y:9.22-42: error: code of token TOO_LARGE_DEC too large too-large.y:10.24-44: error: integer out of range: '0xFFFFFFFFFFFFFFFFFFF' too-large.y:10.24-44: error: code of token TOO_LARGE_HEX too large " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1735" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_37 #AT_START_38 at_fn_group_banner 38 'input.at:1750' \ "Unclosed constructs" " " 2 at_xfail=no ( printf "%s\n" "38. $at_setup_line: testing $at_desc ..." $at_traceon # Bison's scan-gram.l once forgot to STRING_FINISH () some unclosed # constructs, so they were prepended to whatever it STRING_GROW ()'ed # next. It also threw them away rather than returning them to the # parser. The effect was confusing subsequent error messages. cat >input.y <<'_ATEOF' %token A "a %token B "b" %token AB "ab" // Used to complain that "ab" was already used. %token C '1 %token TWO "2" %token TICK_TWELVE "'12" // Used to complain that "'12" was already used. %% start: %empty; // Used to report a syntax error because it didn't see any kind of symbol // identifier. %type 'a ; %type "a ; // Used to report a syntax error because it didn't see braced code. %destructor { free ($$) _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1779: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y" "input.at:1779" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.10-2.0: error: missing '\"' at end of line 1 | %token A \"a | ^~ input.y:4.10-5.0: error: missing \"'\" at end of line 4 | %token C '1 | ^~ input.y:14.11-15.0: error: missing \"'\" at end of line 14 | %type 'a | ^~ input.y:16.11-17.0: error: missing '\"' at end of line 16 | %type \"a | ^~ input.y:19.13-20.0: error: missing '}' at end of file 19 | %destructor { free (\$\$) | ^~~~~~~~~~~ input.y:20.1: error: unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1779" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_38 #AT_START_39 at_fn_group_banner 39 'input.at:1805' \ "%start after first rule" " " 2 at_xfail=no ( printf "%s\n" "39. $at_setup_line: testing $at_desc ..." $at_traceon # Bison once complained that a %start after the first rule was a # redeclaration of the start symbol. cat >input.y <<'_ATEOF' %% false_start: %empty; start: false_start ; %start start; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1817: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1817" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1817" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1817: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:1817" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1817" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1817: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1817" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1817" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1817: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1817" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1817" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1817: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1817" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1817" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1817: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:1817" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1817" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_39 #AT_START_40 at_fn_group_banner 40 'input.at:1826' \ "Duplicate %start symbol" " " 2 at_xfail=no ( printf "%s\n" "40. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %start exp exp exp %% exp: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1836: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1836" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1836: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1836" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1836: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1836" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.12-14: warning: duplicate directive [-Wother] 1 | %start exp exp exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp exp exp | ^~~ input.y:1.16-18: warning: duplicate directive [-Wother] 1 | %start exp exp exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp exp exp | ^~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.12-14: warning: duplicate directive [-Wother] 1 | %start exp exp exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp exp exp | ^~~ input.y:1.16-18: warning: duplicate directive [-Wother] 1 | %start exp exp exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp exp exp | ^~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1836: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1836" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1836: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:1836" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1836" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %start exp foo exp %% exp: foo; foo: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1859: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1859" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1859: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1859" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1859: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1859" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.16-18: warning: duplicate directive [-Wother] 1 | %start exp foo exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp foo exp | ^~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:1.16-18: warning: duplicate directive [-Wother] 1 | %start exp foo exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp foo exp | ^~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1859: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1859" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:1859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1859" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %start exp foo %start exp %% exp: foo; foo: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1877: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1877" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1877: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1877" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1877: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1877" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-10: warning: duplicate directive [-Wother] 2 | %start exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp foo | ^~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.8-10: warning: duplicate directive [-Wother] 2 | %start exp | ^~~ input.y:1.8-10: note: previous declaration 1 | %start exp foo | ^~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1877: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1877" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1877" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_40 #AT_START_41 at_fn_group_banner 41 'input.at:1895' \ "%prec takes a token" " " 2 at_xfail=no ( printf "%s\n" "41. $at_setup_line: testing $at_desc ..." $at_traceon # Bison once allowed %prec sym where sym was a nonterminal. cat >input.y <<'_ATEOF' %% start: PREC %prec PREC ; PREC: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1905: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:1905" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-4: error: rule given for PREC, which is a token " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1905" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_41 #AT_START_42 at_fn_group_banner 42 'input.at:1916' \ "%prec's token must be defined" " " 2 at_xfail=no ( printf "%s\n" "42. $at_setup_line: testing $at_desc ..." $at_traceon # According to POSIX, a %prec token must be defined separately. cat >input.y <<'_ATEOF' %% start: %prec PREC ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:1925: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1925" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:1925: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:1925" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:1925: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:1925" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-17: warning: token for %prec is not defined: PREC [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.8-17: warning: token for %prec is not defined: PREC [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:1925: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:1925" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:1925: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:1925" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:1925" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_42 #AT_START_43 at_fn_group_banner 43 'input.at:1936' \ "Reject unused %code qualifiers" " " 2 at_xfail=no ( printf "%s\n" "43. $at_setup_line: testing $at_desc ..." $at_traceon cat >input-c.y <<'_ATEOF' %code q {} %code bad {} %code bad {} %code format {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1946: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c.y" "input.at:1946" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-c.y:1.7: error: %code qualifier 'q' is not used input-c.y:2.7-9: error: %code qualifier 'bad' is not used input-c.y:3.7-9: error: %code qualifier 'bad' is not used input-c.y:4.7-12: error: %code qualifier 'format' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1946" $at_failed && at_fn_log_failure $at_traceon; } cat >input-c-glr.y <<'_ATEOF' %code q {} %code bad {} %code bad {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1960: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c-glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c-glr.y" "input.at:1960" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c-glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-c-glr.y:1.7: error: %code qualifier 'q' is not used input-c-glr.y:2.7-9: error: %code qualifier 'bad' is not used input-c-glr.y:3.8-10: error: %code qualifier 'bad' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1960" $at_failed && at_fn_log_failure $at_traceon; } cat >input-c++.y <<'_ATEOF' %code q {} %code bad {} %code q {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1973: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c++.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c++.y" "input.at:1973" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c++.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-c++.y:1.7: error: %code qualifier 'q' is not used input-c++.y:2.7-9: error: %code qualifier 'bad' is not used input-c++.y:3.8: error: %code qualifier 'q' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1973" $at_failed && at_fn_log_failure $at_traceon; } cat >input-c++-glr.y <<'_ATEOF' %code bad {} %code q {} %code q {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1986: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c++-glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c++-glr.y" "input.at:1986" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-c++-glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-c++-glr.y:1.7-9: error: %code qualifier 'bad' is not used input-c++-glr.y:2.7: error: %code qualifier 'q' is not used input-c++-glr.y:3.7: error: %code qualifier 'q' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1986" $at_failed && at_fn_log_failure $at_traceon; } cat >special-char-@@.y <<'_ATEOF' %code bad {} %code q {} %code q {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:1999: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret special-char-@@.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret special-char-@@.y" "input.at:1999" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret special-char-@@.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "special-char-@@.y:1.7-9: error: %code qualifier 'bad' is not used special-char-@@.y:2.7: error: %code qualifier 'q' is not used special-char-@@.y:3.7: error: %code qualifier 'q' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:1999" $at_failed && at_fn_log_failure $at_traceon; } cat >special-char-].y <<'_ATEOF' %code bad {} %code q {} %code q {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2012: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret special-char-].y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret special-char-].y" "input.at:2012" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret special-char-].y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "special-char-].y:1.7-9: error: %code qualifier 'bad' is not used special-char-].y:2.7: error: %code qualifier 'q' is not used special-char-].y:3.7: error: %code qualifier 'q' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2012" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_43 #AT_START_44 at_fn_group_banner 44 'input.at:2025' \ "Multiple %code" " " 2 at_xfail=no ( printf "%s\n" "44. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure that repeated arguments to %code are separated by # end-of-lines. At some point, a missing eol would leave synclines # appended to the previous value. Here, we use CPP directive to # introduce dependency on the absence/presence of the eol. cat >input.y <<'_ATEOF' %code {#include } %code {#define A B} %code {#define B C} %code {#define C D} %code {#define D 42} %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% start: %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { assert (A == 42); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2054: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2054" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2054: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "input.at:2054" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2054: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2054" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2054: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2054" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2054: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2054" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2054: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "input.at:2054" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "input.at:2054" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/input.at:2054" { set +x printf "%s\n" "$at_srcdir/input.at:2054: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "input.at:2054" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2055: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "input.at:2055" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2055" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2055: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "input.at:2055" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2055" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_44 #AT_START_45 at_fn_group_banner 45 'input.at:2065' \ "errors" " " 2 at_xfail=no ( printf "%s\n" "45. $at_setup_line: testing $at_desc ..." $at_traceon cat >input-redefined.y <<'_ATEOF' %define var "value1" %define var "value1" %define var "value2" %define special1 "]" %define special2 "[" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2077: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-redefined.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-redefined.y" "input.at:2077" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-redefined.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-redefined.y:2.1-20: warning: %define variable 'var' redefined [-Wother] input-redefined.y:1.1-20: note: previous definition input-redefined.y:3.2-21: error: %define variable 'var' redefined input-redefined.y:2.1-20: note: previous definition input-redefined.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2077" $at_failed && at_fn_log_failure $at_traceon; } cat >input-unused.y <<'_ATEOF' %define var "value" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2091: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-unused.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-unused.y" "input.at:2091" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-unused.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-unused.y:1.1-19: error: %define variable 'var' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2091" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_45 #AT_START_46 at_fn_group_banner 46 'input.at:2102' \ "%define, --define, --force-define" " " 2 at_xfail=no ( printf "%s\n" "46. $at_setup_line: testing $at_desc ..." $at_traceon cat >skel.c <<'_ATEOF' m4_divert_push(0)@ @output(b4_parser_file_name@)@ [var-dd: ]b4_percent_define_get([[var-dd]])[ var-ff: ]b4_percent_define_get([[var-ff]])[ var-dfg: ]b4_percent_define_get([[var-dfg]])[ var-fd: ]b4_percent_define_get([[var-fd]]) m4_divert_pop(0) _ATEOF cat >input.y <<'_ATEOF' %define var-dfg "gram" %% start: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2118: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \\ -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \\ -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \\ -Fvar-fd=cmd-f -Dvar-fd=cmd-d \\ --skeleton ./skel.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2118" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \ -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \ -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \ -Fvar-fd=cmd-f -Dvar-fd=cmd-d \ --skeleton ./skel.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2118" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2118: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \\ -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \\ -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \\ -Fvar-fd=cmd-f -Dvar-fd=cmd-d \\ --skeleton ./skel.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2118" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \ -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \ -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \ -Fvar-fd=cmd-f -Dvar-fd=cmd-d \ --skeleton ./skel.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2118" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2118: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2118" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2118" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2118: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2118" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2118" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2118: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2118" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2118" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2118: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \\ -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \\ -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \\ -Fvar-fd=cmd-f -Dvar-fd=cmd-d \\ --skeleton ./skel.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2118" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \ -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \ -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \ -Fvar-fd=cmd-f -Dvar-fd=cmd-d \ --skeleton ./skel.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2118" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2123: cat input.tab.c" at_fn_check_prepare_trace "input.at:2123" ( $at_check_trace; cat input.tab.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "var-dd: cmd-d2 var-ff: cmd-f2 var-dfg: cmd-f var-fd: cmd-d " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2123" $at_failed && at_fn_log_failure $at_traceon; } cat >input-dg.y <<'_ATEOF' %define var "gram" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2135: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dvar=cmd-d input-dg.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dvar=cmd-d input-dg.y" "input.at:2135" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dvar=cmd-d input-dg.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-dg.y:1.1-18: error: %define variable 'var' redefined :3: note: previous definition input-dg.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2135" $at_failed && at_fn_log_failure $at_traceon; } cat >input-dg.y <<'_ATEOF' %define var "gram" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Dvar=cmd-d input-dg.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Dvar=cmd-d input-dg.y" "input.at:2146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Dvar=cmd-d input-dg.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-dg.y:1.1-18: error: %define variable 'var' redefined 1 | %define var \"gram\" | ^~~~~~~~~~~~~~~~~~ :4: note: previous definition input-dg.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2146" $at_failed && at_fn_log_failure $at_traceon; } cat >input-unused.y <<'_ATEOF' %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2158: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dunused-d -Funused-f input-unused.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dunused-d -Funused-f input-unused.y" "input.at:2158" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dunused-d -Funused-f input-unused.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":3: error: %define variable 'unused-d' is not used :4: error: %define variable 'unused-f' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2158" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_46 #AT_START_47 at_fn_group_banner 47 'input.at:2170' \ "\"%define\" Boolean variables" " " 2 at_xfail=no ( printf "%s\n" "47. $at_setup_line: testing $at_desc ..." $at_traceon cat >Input.y <<'_ATEOF' %language "Java" %define api.parser.class {Input} %define api.parser.public {maybe} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2180: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret Input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret Input.y" "input.at:2180" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret Input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Input.y:3.1-33: error: invalid value for %define Boolean variable 'api.parser.public' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2180" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_47 #AT_START_48 at_fn_group_banner 48 'input.at:2191' \ "\"%define\" code variables" " " 2 at_xfail=no ( printf "%s\n" "48. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %skeleton "lalr1.cc" %locations %define api.location.type quux %define api.namespace quux %define api.prefix quux %define api.token.prefix quux %token TOK // Otherwise api.token.prefix is unused. %% start: TOK; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.yy" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.yy" "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2213: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2213" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2213: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2213" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2213: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2213" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.yy" at_fn_check_prepare_trace "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.yy:2.1-30: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated] input.yy:4.1-30: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated] input.yy:5.1-30: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated] input.yy:3.1-30: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Werror" "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.yy:2.1-30: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated] input.yy:4.1-30: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated] input.yy:5.1-30: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated] input.yy:3.1-30: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2213: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2213" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=error" "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Wnone,none -Werror --trace=none" "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2213: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=none -Werror --trace=none" "input.at:2213" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2213" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.yy <<'_ATEOF' %skeleton "lalr1.cc" %locations %define api.location.type "quux" %define api.namespace "quux" %define api.prefix "quux" %define api.token.prefix "quux" %token TOK // Otherwise api.token.prefix is unused. %% start: TOK; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.yy" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.yy" "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2214: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2214" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2214: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2214" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2214: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2214" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.yy" at_fn_check_prepare_trace "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.yy:2.1-32: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated] input.yy:4.1-32: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated] input.yy:5.1-32: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated] input.yy:3.1-32: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Werror" "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.yy:2.1-32: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated] input.yy:4.1-32: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated] input.yy:5.1-32: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated] input.yy:3.1-32: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2214: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2214" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=error" "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Wnone,none -Werror --trace=none" "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=none -Werror --trace=none" "input.at:2214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.yy --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2214" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_48 #AT_START_49 at_fn_group_banner 49 'input.at:2224' \ "\"%define\" keyword variables" " " 2 at_xfail=no ( printf "%s\n" "49. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %define api.pure "true" %define api.push-pull "both" %define lr.default-reduction "most" %define lr.keep-unreachable-state "true" %define lr.type "lalr" %% exp: %empty _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2246: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2246" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2246: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2246" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2246: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2246" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:5.1-40: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated] input.y:3.1-40: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated] input.y:4.1-40: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated] input.y:1.1-38: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated] input.y:2.1-40: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:5.1-40: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated] input.y:3.1-40: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated] input.y:4.1-40: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated] input.y:1.1-38: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated] input.y:2.1-40: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2246: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2246" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:2246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2246" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %define api.pure {true} %define api.push-pull {both} %define lr.default-reduction {most} %define lr.keep-unreachable-state {true} %define lr.type {lalr} %% exp: %empty _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2247: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2247" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2247: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2247" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2247: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2247" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:5.1-40: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated] input.y:3.1-40: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated] input.y:4.1-40: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated] input.y:1.1-38: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated] input.y:2.1-40: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:5.1-40: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated] input.y:3.1-40: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated] input.y:4.1-40: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated] input.y:1.1-38: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated] input.y:2.1-40: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2247: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2247" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:2247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2247" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_49 #AT_START_50 at_fn_group_banner 50 'input.at:2257' \ "\"%define\" enum variables" " " 2 at_xfail=no ( printf "%s\n" "50. $at_setup_line: testing $at_desc ..." $at_traceon # Check errors from the front-end, and the back-end. Since the # front-end quits before calling the back-end, these tests cannot be # fused. # Front-end. cat >input.y <<'_ATEOF' %define lr.default-reduction bogus %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2269: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:2269" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-34: error: invalid value for %define variable 'lr.default-reduction': 'bogus' 1 | %define lr.default-reduction bogus | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:1.1-34: note: accepted value: 'most' input.y:1.1-34: note: accepted value: 'consistent' input.y:1.1-34: note: accepted value: 'accepting' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2269" $at_failed && at_fn_log_failure $at_traceon; } # Check escapes. cat >input.y <<'_ATEOF' %define lr.default-reduction {[$@]} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:2284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-35: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated] 1 | %define lr.default-reduction {[\$@]} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:1.1-35: error: invalid value for %define variable 'lr.default-reduction': '[\$@]' 1 | %define lr.default-reduction {[\$@]} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:1.1-35: note: accepted value: 'most' input.y:1.1-35: note: accepted value: 'consistent' input.y:1.1-35: note: accepted value: 'accepting' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2284" $at_failed && at_fn_log_failure $at_traceon; } # Back-end. cat >input.y <<'_ATEOF' %define api.push-pull neither %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2303: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:2303" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-29: error: invalid value for %define variable 'api.push-pull': 'neither' 1 | %define api.push-pull neither | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:1.1-29: note: accepted value: 'pull' input.y:1.1-29: note: accepted value: 'push' input.y:1.1-29: note: accepted value: 'both' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2303" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_50 #AT_START_51 at_fn_group_banner 51 'input.at:2320' \ "\"%define\" file variables" " " 2 at_xfail=no ( printf "%s\n" "51. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "lalr1.cc" %locations %define api.location.file {bogus} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:2329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-33: error: %define variable 'api.location.file' requires 'none' or '\"...\"' values 3 | %define api.location.file {bogus} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2329" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_51 #AT_START_52 at_fn_group_banner 52 'input.at:2342' \ "\"%define\" backward compatibility" " " 2 at_xfail=no ( printf "%s\n" "52. $at_setup_line: testing $at_desc ..." $at_traceon # The error messages tell us whether the variables are properly updated. cat >input.y <<'_ATEOF' %define api.push_pull both %define lr.keep_unreachable_states maybe %define namespace "foo" %define variant %define parser_class_name {parser} %define filename_type {filename} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:2355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-26: warning: deprecated directive: '%define api.push_pull both', use '%define api.push-pull both' [-Wdeprecated] 1 | %define api.push_pull both | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | %define api.push-pull both input.y:2.1-40: warning: deprecated directive: '%define lr.keep_unreachable_states maybe', use '%define lr.keep-unreachable-state maybe' [-Wdeprecated] 2 | %define lr.keep_unreachable_states maybe | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %define lr.keep-unreachable-state maybe input.y:3.1-23: warning: deprecated directive: '%define namespace \"foo\"', use '%define api.namespace {foo}' [-Wdeprecated] 3 | %define namespace \"foo\" | ^~~~~~~~~~~~~~~~~~~~~~~ | %define api.namespace {foo} input.y:4.1-15: warning: deprecated directive: '%define variant', use '%define api.value.type variant' [-Wdeprecated] 4 | %define variant | ^~~~~~~~~~~~~~~ | %define api.value.type variant input.y:5.1-34: warning: deprecated directive: '%define parser_class_name {parser}', use '%define api.parser.class {parser}' [-Wdeprecated] 5 | %define parser_class_name {parser} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %define api.parser.class {parser} input.y:6.1-32: warning: deprecated directive: '%define filename_type {filename}', use '%define api.filename.type {filename}' [-Wdeprecated] 6 | %define filename_type {filename} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %define api.filename.type {filename} input.y:2.1-40: error: invalid value for %define Boolean variable 'lr.keep-unreachable-state' 2 | %define lr.keep_unreachable_states maybe | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2355" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_52 #AT_START_53 at_fn_group_banner 53 'input.at:2393' \ "Unused api.pure" " " 2 at_xfail=no ( printf "%s\n" "53. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST(DECLS, VALUE, LOCATION) # ------------------------------- # Make sure Bison reports that '%define api.pure VALUE' is unused when DECLS # are specified. cat >input.y <<'_ATEOF' %define api.pure %language "c++" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2413: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2413" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-16: error: %define variable 'api.pure' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2413" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.pure false %language "c++" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-22: error: %define variable 'api.pure' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2414" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.pure "" %language "c++" %glr-parser %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2415: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2415" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-19: error: %define variable 'api.pure' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2415" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.pure false %language "c++" %glr-parser %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-22: error: %define variable 'api.pure' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2416" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.pure true %language "java" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-21: error: %define variable 'api.pure' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2417" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.pure false %language "java" %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2418: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2418" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-22: error: %define variable 'api.pure' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2418" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_53 #AT_START_54 at_fn_group_banner 54 'input.at:2429' \ "C++ namespace reference errors" " " 2 at_xfail=no ( printf "%s\n" "54. $at_setup_line: testing $at_desc ..." $at_traceon # AT_CHECK_NAMESPACE_ERROR(NAMESPACE-DECL, ERROR, [ERROR], ...) # ------------------------------------------------------------- # Make sure Bison reports all ERROR's for %define namespace "NAMESPACE-DECL". cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2450: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2450" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-24: error: namespace reference is empty " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2450" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace { } %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2452: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2452" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-57: error: namespace reference is empty " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2452" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {foo::::bar} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2454: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2454" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-34: error: namespace reference has consecutive \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2454" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {foo:: ::bar} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-38: error: namespace reference has consecutive \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2456" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {::::bar} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2458: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2458" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-31: error: namespace reference has consecutive \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2458" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {:: ::bar} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-32: error: namespace reference has consecutive \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2460" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {foo::bar:: ::} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2462: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2462" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-43: error: namespace reference has consecutive \"::\" input.y:3.1-43: error: namespace reference has a trailing \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2462" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {foo::bar::} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2465: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2465" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-34: error: namespace reference has a trailing \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2465" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {foo::bar:: } %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2467: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2467" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-41: error: namespace reference has a trailing \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2467" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %language "C++" %header %define api.namespace {::} %% start: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2469: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2469" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-26: error: namespace reference has a trailing \"::\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2469" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_54 #AT_START_55 at_fn_group_banner 55 'input.at:2482' \ "Bad character literals" " " 2 at_xfail=no ( printf "%s\n" "55. $at_setup_line: testing $at_desc ..." $at_traceon cat >empty.y <<'_ATEOF' %% start: ''; start: ' start: ' _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2484: set x \`LC_ALL=C ls -l 'empty.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='empty.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2484" ( $at_check_trace; set x `LC_ALL=C ls -l 'empty.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='empty.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2484" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2490: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret empty.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret empty.y" "input.at:2490" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret empty.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "empty.y:2.8-9: error: empty character literal 2 | start: ''; | ^~ empty.y:3.8-4.0: error: missing \"'\" at end of line 3 | start: ' | ^ empty.y:3.8-4.0: error: empty character literal 3 | start: ' | ^ empty.y:4.8: error: missing \"'\" at end of file 4 | start: ' | ^ empty.y:4.8: error: empty character literal 4 | start: ' | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2490" $at_failed && at_fn_log_failure $at_traceon; } cat >two.y <<'_ATEOF' %% start: 'ab'; start: 'ab start: 'ab _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2508: set x \`LC_ALL=C ls -l 'two.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='two.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2508" ( $at_check_trace; set x `LC_ALL=C ls -l 'two.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='two.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2508" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2514: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret two.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret two.y" "input.at:2514" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret two.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "two.y:2.8-11: error: extra characters in character literal two.y:3.8-4.0: error: missing \"'\" at end of line two.y:3.8-4.0: error: extra characters in character literal two.y:4.8-10: error: missing \"'\" at end of file two.y:4.8-10: error: extra characters in character literal " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2514" $at_failed && at_fn_log_failure $at_traceon; } cat >three.y <<'_ATEOF' %% start: 'abc'; start: 'abc start: 'abc _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2522: set x \`LC_ALL=C ls -l 'three.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='three.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2522" ( $at_check_trace; set x `LC_ALL=C ls -l 'three.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='three.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2522" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2528: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret three.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret three.y" "input.at:2528" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret three.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "three.y:2.8-12: error: extra characters in character literal three.y:3.8-4.0: error: missing \"'\" at end of line three.y:3.8-4.0: error: extra characters in character literal three.y:4.8-11: error: missing \"'\" at end of file three.y:4.8-11: error: extra characters in character literal " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2528" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_55 #AT_START_56 at_fn_group_banner 56 'input.at:2543' \ "Bad escapes in literals" " " 2 at_xfail=no ( printf "%s\n" "56. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% start: '\777' '\0' '\xfff' '\x0' '\uffff' '\u0000' '\Uffffffff' '\U00000000' '\ ' '\A'; _ATEOF # It is not easy to create special characters, we cannot even trust tr. # Beside we cannot even expect "echo '\0'" to output two characters # (well three with \n): at least Bash 3.2 converts the two-character # sequence "\0" into a single NUL character. { set +x printf "%s\n" "$at_srcdir/input.at:2556: \"\$PERL\" -e 'print \"start: \\\"\\\\\\t\\\\\\f\\\\\\0\\\\\\1\\\" ;\";' >> input.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -e 'print \"start: \\\"\\\\\\t\\\\\\f\\\\\\0\\\\\\1\\\" ;\";' >> input.y || exit 77" "input.at:2556" ( $at_check_trace; "$PERL" -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2556" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2558: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2558" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.9-12: error: invalid number after \\-escape: 777 input.y:2.16-17: error: invalid number after \\-escape: 0 input.y:2.21-25: error: invalid number after \\-escape: xfff input.y:2.29-31: error: invalid number after \\-escape: x0 input.y:3.9-14: error: invalid number after \\-escape: uffff input.y:3.18-23: error: invalid number after \\-escape: u0000 input.y:3.27-36: error: invalid number after \\-escape: Uffffffff input.y:3.40-49: error: invalid number after \\-escape: U00000000 input.y:4.9-10: error: invalid character after \\-escape: ' ' input.y:4.14-15: error: invalid character after \\-escape: A input.y:5.9-16: error: invalid character after \\-escape: \\t input.y:5.17: error: invalid character after \\-escape: \\f input.y:5.18: error: invalid character after \\-escape: \\0 input.y:5.19: error: invalid character after \\-escape: \\001 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2558" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_56 #AT_START_57 at_fn_group_banner 57 'input.at:2582' \ "Unexpected end of file" " " 2 at_xfail=no ( printf "%s\n" "57. $at_setup_line: testing $at_desc ..." $at_traceon : >input.y { set +x printf "%s\n" "$at_srcdir/input.at:2586: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:2586" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1: error: unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2586" $at_failed && at_fn_log_failure $at_traceon; } cat >char.y <<'_ATEOF' %token FOO ' _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2591: set x \`LC_ALL=C ls -l 'char.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='char.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2591" ( $at_check_trace; set x `LC_ALL=C ls -l 'char.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='char.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2591" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2594: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret char.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret char.y" "input.at:2594" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret char.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "char.y:1.12: error: missing \"'\" at end of file 1 | %token FOO ' | ^ char.y:1.12: error: empty character literal 1 | %token FOO ' | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2594" $at_failed && at_fn_log_failure $at_traceon; } cat >escape-in-char.y <<'_ATEOF' %token FOO '\ _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2604: set x \`LC_ALL=C ls -l 'escape-in-char.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='escape-in-char.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2604" ( $at_check_trace; set x `LC_ALL=C ls -l 'escape-in-char.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='escape-in-char.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2604" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2607: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-char.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-char.y" "input.at:2607" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-char.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "escape-in-char.y:1.12-13: error: missing '?\\'' at end of file 1 | %token FOO '\\ | ^~ escape-in-char.y:1.14: error: unexpected end of file 1 | %token FOO '\\ | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2607" $at_failed && at_fn_log_failure $at_traceon; } cat >string.y <<'_ATEOF' %token FOO " _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2617: set x \`LC_ALL=C ls -l 'string.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='string.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2617" ( $at_check_trace; set x `LC_ALL=C ls -l 'string.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='string.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2617" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2620: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret string.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret string.y" "input.at:2620" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret string.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "string.y:1.12: error: missing '\"' at end of file 1 | %token FOO \" | ^ string.y:1.13: error: unexpected end of file 1 | %token FOO \" | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2620" $at_failed && at_fn_log_failure $at_traceon; } cat >escape-in-string.y <<'_ATEOF' %token FOO "\ _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2630: set x \`LC_ALL=C ls -l 'escape-in-string.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='escape-in-string.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2630" ( $at_check_trace; set x `LC_ALL=C ls -l 'escape-in-string.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='escape-in-string.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2630" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2633: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-string.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-string.y" "input.at:2633" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-string.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "escape-in-string.y:1.12-13: error: missing '?\"' at end of file 1 | %token FOO \"\\ | ^~ escape-in-string.y:1.14: error: unexpected end of file 1 | %token FOO \"\\ | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2633" $at_failed && at_fn_log_failure $at_traceon; } cat >tstring.y <<'_ATEOF' %token FOO _(" _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2643: set x \`LC_ALL=C ls -l 'tstring.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='tstring.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2643" ( $at_check_trace; set x `LC_ALL=C ls -l 'tstring.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='tstring.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2643" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2646: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret tstring.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret tstring.y" "input.at:2646" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret tstring.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "tstring.y:1.12-14: error: missing '\")' at end of file 1 | %token FOO _(\" | ^~~ tstring.y:1.15: error: unexpected end of file 1 | %token FOO _(\" | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2646" $at_failed && at_fn_log_failure $at_traceon; } cat >escape-in-tstring.y <<'_ATEOF' %token FOO _("\ _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2656: set x \`LC_ALL=C ls -l 'escape-in-tstring.y'\` && size=\$6 && { test \$size -eq 0 || dd obs=1 seek=\`expr \$size - 1\` if=/dev/null of='escape-in-tstring.y'; } || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2656" ( $at_check_trace; set x `LC_ALL=C ls -l 'escape-in-tstring.y'` && size=$6 && { test $size -eq 0 || dd obs=1 seek=`expr $size - 1` if=/dev/null of='escape-in-tstring.y'; } || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2656" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2659: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-tstring.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-tstring.y" "input.at:2659" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret escape-in-tstring.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "escape-in-tstring.y:1.12-15: error: missing '?\")' at end of file 1 | %token FOO _(\"\\ | ^~~~ escape-in-tstring.y:1.16: error: unexpected end of file 1 | %token FOO _(\"\\ | ^ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2659" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_57 #AT_START_58 at_fn_group_banner 58 'input.at:2675' \ "LAC: Errors for %define" " " 2 at_xfail=no ( printf "%s\n" "58. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% start: %empty; _ATEOF # Only "full" and "none" are accepted for parse.lac # Unknown values (such as "unsupported") are rejected if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Syacc.c -Dparse.lac=none input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Syacc.c -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Syacc.c -Dparse.lac=none input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Syacc.c -Dparse.lac=none input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Syacc.c -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=none input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Syacc.c -Dparse.lac=full input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Syacc.c -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Syacc.c -Dparse.lac=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Syacc.c -Dparse.lac=full input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Syacc.c -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=full input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=unsupported input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=unsupported input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Syacc.c -Dparse.lac=unsupported input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":4: error: invalid value for %define variable 'parse.lac': 'unsupported' :4: note: accepted value: 'full' :4: note: accepted value: 'none' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Slalr1.cc -Dparse.lac=none input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Slalr1.cc -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.cc -Dparse.lac=none input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.cc -Dparse.lac=none input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.cc -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=none input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Slalr1.cc -Dparse.lac=full input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Slalr1.cc -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.cc -Dparse.lac=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.cc -Dparse.lac=full input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.cc -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=full input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=unsupported input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=unsupported input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=unsupported input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":4: error: invalid value for %define variable 'parse.lac': 'unsupported' :4: note: accepted value: 'full' :4: note: accepted value: 'none' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Slalr1.d -Dparse.lac=none input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Slalr1.d -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.d -Dparse.lac=none input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.d -Dparse.lac=none input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.d -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=none input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Slalr1.d -Dparse.lac=full input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Slalr1.d -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.d -Dparse.lac=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.d -Dparse.lac=full input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.d -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=full input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=unsupported input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=unsupported input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.d -Dparse.lac=unsupported input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":4: error: invalid value for %define variable 'parse.lac': 'unsupported' :4: note: accepted value: 'full' :4: note: accepted value: 'none' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Slalr1.java -Dparse.lac=none input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Slalr1.java -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.java -Dparse.lac=none input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.java -Dparse.lac=none input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.java -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=none input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Slalr1.java -Dparse.lac=full input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Slalr1.java -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.java -Dparse.lac=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.java -Dparse.lac=full input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Slalr1.java -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2685: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2685: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2685" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=full input.y" at_fn_check_prepare_trace "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2685: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=unsupported input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=unsupported input.y" "input.at:2685" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=unsupported input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":4: error: invalid value for %define variable 'parse.lac': 'unsupported' :4: note: accepted value: 'full' :4: note: accepted value: 'none' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2685" $at_failed && at_fn_log_failure $at_traceon; } # parse.lac.* options are useless if LAC isn't actually activated. { set +x printf "%s\n" "$at_srcdir/input.at:2697: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y" "input.at:2697" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":3: error: %define variable 'parse.lac.es-capacity-initial' is not used :4: error: %define variable 'parse.lac.memory-trace' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2697" $at_failed && at_fn_log_failure $at_traceon; } # parse.lac.* options are useless in C++/Java even if LAC is actually activated. { set +x printf "%s\n" "$at_srcdir/input.at:2704: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y" "input.at:2704" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.cc -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":5: error: %define variable 'parse.lac.es-capacity-initial' is not used :6: error: %define variable 'parse.lac.memory-trace' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2704" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2704: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y" "input.at:2704" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Slalr1.java -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":5: error: %define variable 'parse.lac.es-capacity-initial' is not used :6: error: %define variable 'parse.lac.memory-trace' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2704" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_58 #AT_START_59 at_fn_group_banner 59 'input.at:2719' \ "-Werror combinations" " " 2 at_xfail=no ( printf "%s\n" "59. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% a: '0' { $$ = $; }; _ATEOF # -Werror is not enabled by -Wall or equivalent. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y" "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2727: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2727" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2727: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2727" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2727: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2727" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall input.y" at_fn_check_prepare_trace "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: warning: stray '\$' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Werror" "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.15: warning: stray '$' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2727: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2727" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=error" "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Wnone,none -Werror --trace=none" "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=none -Werror --trace=none" "input.at:2727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2727" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -W input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -W input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -W input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -W input.y" "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -W input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2730: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2730" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2730: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2730" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2730: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2730" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -W input.y" at_fn_check_prepare_trace "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -W input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: warning: stray '\$' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y -Werror" "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.15: warning: stray '$' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2730: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2730" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y --warnings=error" "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y -Wnone,none -Werror --trace=none" "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2730: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y --warnings=none -Werror --trace=none" "input.at:2730" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -W input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2730" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-none input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-none input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-none input.y" "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2733: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2733" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2733: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2733" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2733: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2733" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-none input.y" at_fn_check_prepare_trace "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-none input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: warning: stray '\$' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y -Werror" "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.15: warning: stray '$' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2733: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2733" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y --warnings=error" "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y -Wnone,none -Werror --trace=none" "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2733: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y --warnings=none -Werror --trace=none" "input.at:2733" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-none input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2733" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # -Werror is not disabled by -Wnone or equivalent. { set +x printf "%s\n" "$at_srcdir/input.at:2738: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror,none,other input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror,none,other input.y" "input.at:2738" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror,none,other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: error: stray '\$' [-Werror=other] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2738" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2741: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror,no-all,other input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror,no-all,other input.y" "input.at:2741" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror,no-all,other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: error: stray '\$' [-Werror=other] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2741" $at_failed && at_fn_log_failure $at_traceon; } # Check that -Wno-error keeps warnings enabled, but non fatal. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2746: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Werror -Wno-error=other input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2746" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Werror -Wno-error=other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2746" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2746: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror -Wno-error=other input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror -Wno-error=other input.y" "input.at:2746" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror -Wno-error=other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2746" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2746: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2746" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2746" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2746: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2746" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2746" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2746: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2746" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2746" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2746: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror -Wno-error=other input.y" at_fn_check_prepare_trace "input.at:2746" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror -Wno-error=other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: warning: stray '\$' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2746" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2750: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-error=other -Werror input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2750" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-error=other -Werror input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2750" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2750: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-error=other -Werror input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-error=other -Werror input.y" "input.at:2750" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-error=other -Werror input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2750" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2750: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2750" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2750" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2750: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2750" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2750" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2750: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2750" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2750" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2750: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-error=other -Werror input.y" at_fn_check_prepare_trace "input.at:2750" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-error=other -Werror input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.15: warning: stray '\$' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2750" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2754: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Werror=other -Wno-other input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2754" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Werror=other -Wno-other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2754" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2754: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror=other -Wno-other input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror=other -Wno-other input.y" "input.at:2754" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror=other -Wno-other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2754" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2754: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2754" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2754" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2754: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2754" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2754" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2754: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2754" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2754" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2754: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror=other -Wno-other input.y" at_fn_check_prepare_trace "input.at:2754" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror=other -Wno-other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2754" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_59 #AT_START_60 at_fn_group_banner 60 'input.at:2764' \ "%name-prefix and api.prefix are incompatible" " " 2 at_xfail=no ( printf "%s\n" "60. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION) # -------------------------------------------- cat >input.y <<'_ATEOF' %define api.prefix {foo} %name-prefix "bar" %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2779: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-deprecated input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-deprecated input.y" "input.at:2779" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-deprecated input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-24: error: '%name-prefix' and '%define api.prefix' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2779" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2780: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dapi.prefix={foo} -p bar -Wno-deprecated input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dapi.prefix={foo} -p bar -Wno-deprecated input.y" "input.at:2780" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dapi.prefix={foo} -p bar -Wno-deprecated input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":3: error: '%name-prefix' and '%define api.prefix' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2780" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %name-prefix "bar" %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2781: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dapi.prefix={foo} -Wno-deprecated input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dapi.prefix={foo} -Wno-deprecated input.y" "input.at:2781" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dapi.prefix={foo} -Wno-deprecated input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":3: error: '%name-prefix' and '%define api.prefix' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2781" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.prefix {foo} %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2782: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -p bar -Wno-deprecated input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -p bar -Wno-deprecated input.y" "input.at:2782" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -p bar -Wno-deprecated input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-24: error: '%name-prefix' and '%define api.prefix' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2782" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_60 #AT_START_61 at_fn_group_banner 61 'input.at:2793' \ "Redefined %union name" " " 2 at_xfail=no ( printf "%s\n" "61. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST(DIRECTIVES, EXIT-STATUS, ERROR) # --------------------------------------- cat >input.y <<'_ATEOF' %union foo {}; %union {}; %union foo {}; %define api.value.union.name foo %% exp: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2808: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2808" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.8-10: warning: %define variable 'api.value.union.name' redefined [-Wother] input.y:1.8-10: note: previous definition input.y:4.1-32: warning: %define variable 'api.value.union.name' redefined [-Wother] input.y:3.8-10: note: previous definition input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:3.8-10: warning: %define variable 'api.value.union.name' redefined [-Wother] input.y:1.8-10: note: previous definition input.y:4.1-32: warning: %define variable 'api.value.union.name' redefined [-Wother] input.y:3.8-10: note: previous definition input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2808: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2808" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:2808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2808" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >input.y <<'_ATEOF' %define api.value.union.name {foo} %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2820: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2820" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-34: error: %define variable 'api.value.union.name' requires keyword values input.y:1.1-34: error: %define variable 'api.value.union.name' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2820" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define api.value.union.name "foo" %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:2825: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:2825" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-34: error: %define variable 'api.value.union.name' requires keyword values input.y:1.1-34: error: %define variable 'api.value.union.name' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2825" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_61 #AT_START_62 at_fn_group_banner 62 'input.at:2840' \ "Stray \$ or @" " " 2 at_xfail=no ( printf "%s\n" "62. $at_setup_line: testing $at_desc ..." $at_traceon # Give %printer and %destructor "<*> exp TOK" instead of "<*>" to # check that the warnings are reported once, not three times. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %type exp %token TOK TOK2 %destructor { $%; @%; } <*> exp TOK; %initial-action { $%; @%; }; %printer { $%; @%; } <*> exp TOK; %{ $ @ %} // Should not warn. %% exp: TOK { $%; @%; $$ = $1; } | 'a' { $<->1; $$ = 1; } | 'b' { $bar>$; } %% $ @ // Should not warn. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y" "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2861: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2861" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2861: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2861" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2861: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2861" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall input.y" at_fn_check_prepare_trace "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:11.19: warning: stray '\$' [-Wother] input.y:11.23: warning: stray '@' [-Wother] input.y:12.19: warning: stray '\$' [-Wother] input.y:12.23: warning: stray '@' [-Wother] input.y:13.19: warning: stray '\$' [-Wother] input.y:13.23: warning: stray '@' [-Wother] input.y:16.19: warning: stray '\$' [-Wother] input.y:16.23: warning: stray '@' [-Wother] input.y:17.19: warning: stray '\$' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Werror" "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:11.19: warning: stray '$' [-Wother] input.y:11.23: warning: stray '@' [-Wother] input.y:12.19: warning: stray '$' [-Wother] input.y:12.23: warning: stray '@' [-Wother] input.y:13.19: warning: stray '$' [-Wother] input.y:13.23: warning: stray '@' [-Wother] input.y:16.19: warning: stray '$' [-Wother] input.y:16.23: warning: stray '@' [-Wother] input.y:17.19: warning: stray '$' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:2861: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:2861" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=error" "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Wnone,none -Werror --trace=none" "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=none -Werror --trace=none" "input.at:2861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2861" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_62 #AT_START_63 at_fn_group_banner 63 'input.at:2883' \ "Code injection" " " 2 at_xfail=no ( printf "%s\n" "63. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST([MACRO]) # ---------------- # Try to have MACRO be run by bison. cat >input.y <<'_ATEOF' %type exp %token a %token b %initial-action { $$; $$ }; %printer { $$ $$ } <> <*>; %lex-param { b4_canary(%lex-param) }; %parse-param { b4_canary(%parse-param) }; %% exp: a a[name] b { $$; $1; $$ $1 $name $0 ; }; _ATEOF # Disable -Wother to avoid the warnings about the suspicious presence # of `b4_canary` in the output. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S yacc.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S yacc.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S yacc.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S yacc.c -d input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S yacc.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S yacc.c -d input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S yacc.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S glr.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S glr.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.c -d input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.c -d input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S lalr1.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S lalr1.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.cc -d input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.cc -d input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S glr.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S glr.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.cc -d input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.cc -d input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S glr2.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S glr2.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr2.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr2.cc -d input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr2.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr2.cc -d input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr2.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S lalr1.d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S lalr1.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.d input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.d input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S lalr1.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S lalr1.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.java input.y" "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2934: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2934: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2934" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2934: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.java input.y" at_fn_check_prepare_trace "input.at:2934" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2934" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %type <]b4_canary(%type)> exp %token <]b4_canary(%token)> a %token b %initial-action { $$; $<]b4_canary(%initial-action)>$ }; %printer { $$ $<]b4_canary(%printer)>$ } <> <*>; %lex-param { ]b4_canary(%lex-param) }; %parse-param { ]b4_canary(%parse-param) }; %% exp: a a[name] b { $$; $1; $<]b4_canary(action 1)>$ $<]b4_canary(action 2)>1 $<]b4_canary(action 3)>name $<]b4_canary(action 4)>0 ; }; _ATEOF # Disable -Wother to avoid the warnings about the suspicious presence # of `b4_canary` in the output. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S yacc.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S yacc.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S yacc.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S yacc.c -d input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S yacc.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S yacc.c -d input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S yacc.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S glr.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S glr.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.c -d input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.c -d input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S lalr1.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S lalr1.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.cc -d input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.cc -d input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S glr.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S glr.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.cc -d input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.cc -d input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S glr2.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S glr2.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr2.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr2.cc -d input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S glr2.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr2.cc -d input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S glr2.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S lalr1.d input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S lalr1.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.d input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.d input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -S lalr1.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -S lalr1.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.java input.y" "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -S lalr1.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:2935: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:2935: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:2935" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:2935: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.java input.y" at_fn_check_prepare_trace "input.at:2935" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -S lalr1.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:2935" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_63 #AT_START_64 at_fn_group_banner 64 'input.at:2946' \ "Deprecated directives" " " 2 at_xfail=no ( printf "%s\n" "64. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %default_prec %error_verbose %expect_rr 0 %file-prefix = "foo" %file-prefix = "bar" %fixed-output_files %fixed_output-files %fixed-output-files %name-prefix= "foo" %no-default_prec %no_default-prec %no_lines %output = "output.c" %pure_parser %token_table %error-verbose %glr-parser %name-prefix "bar" %defines "header.h" %% exp : '0' _ATEOF cat >errors-all <<'_ATEOF' input.y:10.1-13: warning: deprecated directive: '%default_prec', use '%default-prec' [-Wdeprecated] fix-it:"input.y":{10:1-10:14}:"%default-prec" input.y:11.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated] fix-it:"input.y":{11:1-11:15}:"%define parse.error verbose" input.y:12.1-10: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated] fix-it:"input.y":{12:1-12:11}:"%expect-rr" input.y:13.1-14: warning: deprecated directive: '%file-prefix =', use '%file-prefix' [-Wdeprecated] fix-it:"input.y":{13:1-13:15}:"%file-prefix" input.y:14.1-16.5: warning: duplicate directive: '%file-prefix\n =' [-Wother] input.y:13.1-20: note: previous declaration fix-it:"input.y":{14:1-16:6}:"" input.y:17.9-27: warning: deprecated directive: '%fixed-output_files', use '%output "y.tab.c"' [-Wdeprecated] fix-it:"input.y":{17:2-17:21}:"%output \"y.tab.c\"" input.y:18.9-27: warning: deprecated directive: '%fixed_output-files', use '%output "y.tab.c"' [-Wdeprecated] fix-it:"input.y":{18:9-18:28}:"%output \"y.tab.c\"" input.y:19.1-19: warning: deprecated directive: '%fixed-output-files', use '%output "y.tab.c"' [-Wdeprecated] fix-it:"input.y":{19:1-19:20}:"%output \"y.tab.c\"" input.y:20.1-19: warning: deprecated directive: '%name-prefix= "foo"', use '%define api.prefix {foo}' [-Wdeprecated] fix-it:"input.y":{20:1-20:20}:"%define api.prefix {foo}" input.y:21.1-16: warning: deprecated directive: '%no-default_prec', use '%no-default-prec' [-Wdeprecated] fix-it:"input.y":{21:1-21:17}:"%no-default-prec" input.y:22.1-16: warning: deprecated directive: '%no_default-prec', use '%no-default-prec' [-Wdeprecated] fix-it:"input.y":{22:1-22:17}:"%no-default-prec" input.y:23.1-9: warning: deprecated directive: '%no_lines', use '%no-lines' [-Wdeprecated] fix-it:"input.y":{23:1-23:10}:"%no-lines" input.y:24.1-9: warning: deprecated directive: '%output =', use '%output' [-Wdeprecated] fix-it:"input.y":{24:1-24:10}:"%output" input.y:25.1-12: warning: deprecated directive: '%pure_parser', use '%define api.pure' [-Wdeprecated] fix-it:"input.y":{25:1-25:13}:"%define api.pure" input.y:26.1-12: warning: deprecated directive: '%token_table', use '%token-table' [-Wdeprecated] fix-it:"input.y":{26:1-26:13}:"%token-table" input.y:27.1-14: warning: %define variable 'parse.error' redefined [-Wother] input.y:11.1-14: note: previous definition fix-it:"input.y":{27:1-27:15}:"" input.y:29.1-18: warning: duplicate directive: '%name-prefix "bar"' [-Wother] input.y:13.1-20: note: previous declaration fix-it:"input.y":{29:1-29:19}:"" input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3019: cp errors-all experr" at_fn_check_prepare_trace "input.at:3019" ( $at_check_trace; cp errors-all experr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3019" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:3020: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -ffixit input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:3020" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -ffixit input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3020" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3020: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -ffixit input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -ffixit input.y" "input.at:3020" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -ffixit input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3020" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:3020: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3020" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3020" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:3020: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:3020" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3020" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:3020: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3020" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3020" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:3020: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -ffixit input.y" at_fn_check_prepare_trace "input.at:3020" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -ffixit input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3020" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3022: sed -e '/^fix-it:/d' errors-all >experr" at_fn_check_prepare_trace "input.at:3022" ( $at_check_trace; sed -e '/^fix-it:/d' errors-all >experr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3022" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:3023: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:3023" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3023" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3023: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:3023" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3023" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:3023: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3023" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3023" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:3023: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:3023" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3023" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:3023: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3023" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3023" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:3023: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:3023" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3023" $at_failed && at_fn_log_failure $at_traceon; } # Update the input file. Make sure we generated nothing. { set +x printf "%s\n" "$at_srcdir/input.at:3027: rm -f output.c" at_fn_check_prepare_trace "input.at:3027" ( $at_check_trace; rm -f output.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3028: cp input.y input.y.orig" at_fn_check_prepare_trace "input.at:3028" ( $at_check_trace; cp input.y input.y.orig ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3028" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3029: sed -e '/fix-it/d' experr" at_fn_check_prepare_trace "input.at:3029" ( $at_check_trace; sed -e '/fix-it/d' experr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3029" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3030: echo \"bison: file 'input.y' was updated (backup: 'input.y~')\" >>experr" at_fn_check_prepare_trace "input.at:3030" ( $at_check_trace; echo "bison: file 'input.y' was updated (backup: 'input.y~')" >>experr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3030" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:3031: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --update input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:3031" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --update input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3031" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3031: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --update input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --update input.y" "input.at:3031" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --update input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3031" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:3031: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3031" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3031" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:3031: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:3031" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3031" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:3031: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3031" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3031" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:3031: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --update input.y" at_fn_check_prepare_trace "input.at:3031" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --update input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3031" $at_failed && at_fn_log_failure $at_traceon; } # Check the backup. { set +x printf "%s\n" "$at_srcdir/input.at:3034: diff input.y.orig input.y~" at_fn_check_prepare_trace "input.at:3034" ( $at_check_trace; diff input.y.orig input.y~ ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3034" $at_failed && at_fn_log_failure $at_traceon; } # Check we did not generate any file. { set +x printf "%s\n" "$at_srcdir/input.at:3037: test ! -f output.c" at_fn_check_prepare_trace "input.at:3037" ( $at_check_trace; test ! -f output.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3037" $at_failed && at_fn_log_failure $at_traceon; } # Check the update. { set +x printf "%s\n" "$at_srcdir/input.at:3040: sed -e '1,8d' input.y" at_fn_check_prepare_trace "input.at:3040" ( $at_check_trace; sed -e '1,8d' input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " %default-prec %define parse.error verbose %expect-rr 0 %file-prefix \"foo\" %output \"y.tab.c\" %output \"y.tab.c\" %output \"y.tab.c\" %define api.prefix {foo} %no-default-prec %no-default-prec %no-lines %output \"output.c\" %define api.pure %token-table %glr-parser %defines \"header.h\" %% exp : '0' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3040" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:3062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:3062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3062" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:3062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3062" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:3062: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3062" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3062" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:3062: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:3062" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3062" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:3062: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3062" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3062" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:3062: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:3062" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3062" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_64 #AT_START_65 at_fn_group_banner 65 'input.at:3077' \ "Unput's effect on locations" " " 2 at_xfail=no ( printf "%s\n" "65. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %expect_rr 42 %expect_rr 42 %expect_rr 42 %error_verbose %error_verbose %error_verbose %% exp: '0' _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3092: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:3092" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:11.1-10: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated] input.y:11.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated] input.y:12.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated] input.y:13.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated] input.y:13.16-29: warning: %define variable 'parse.error' redefined [-Wother] input.y:13.1-14: note: previous definition input.y:14.16-29: warning: %define variable 'parse.error' redefined [-Wother] input.y:13.16-29: note: previous definition input.y: error: reduce/reduce conflicts: 0 found, 42 expected input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3092" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_65 #AT_START_66 at_fn_group_banner 66 'input.at:3113' \ "Non-deprecated directives" " " 2 at_xfail=no ( printf "%s\n" "66. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %default-prec %define parse.error verbose %expect-rr 42 %file-prefix "foo" %file-prefix "bar" %no-default-prec %no-lines %output "foo" %token-table %% exp : '0' _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:3133: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3133" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:3133: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:3133" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:3133: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3133" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:14.1-15.5: warning: duplicate directive: '%file-prefix' [-Wother] input.y:13.1-18: note: previous declaration input.y: warning: %expect-rr applies only to GLR parsers [-Wother] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:14.1-15.5: warning: duplicate directive: '%file-prefix' [-Wother] input.y:13.1-18: note: previous declaration input.y: warning: %expect-rr applies only to GLR parsers [-Wother] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:3133: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:3133" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "input.at:3133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3133" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_66 #AT_START_67 at_fn_group_banner 67 'input.at:3148' \ "Cannot type action" " " 2 at_xfail=no ( printf "%s\n" "67. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/input.at:3156: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3156" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/input.at:3156: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "input.at:3156" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/input.at:3156: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "input.at:3156" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:10.6-13: warning: only midrule actions can be typed: int [-Wother] 10 | exp: {} | ^~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:10.6-13: warning: only midrule actions can be typed: int [-Wother] 10 | exp: {} | ^~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/input.at:3156: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "input.at:3156" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/input.at:3156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "input.at:3156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/input.at:3156" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_67 #AT_START_68 at_fn_group_banner 68 'input.at:3171' \ "Character literals and api.token.raw" " " 2 at_xfail=no ( printf "%s\n" "68. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.token.raw %token 'a' %% exp: 'b' "c" {} _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y" "input.at:3181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:10.8-10: error: character literals cannot be used together with api.token.raw 10 | %token 'a' | ^~~ input.y:9.1-21: note: definition of api.token.raw 9 | %define api.token.raw | ^~~~~~~~~~~~~~~~~~~~~ input.y:12.6-8: error: character literals cannot be used together with api.token.raw 12 | exp: 'b' \"c\" {} | ^~~ input.y:9.1-21: note: definition of api.token.raw 9 | %define api.token.raw | ^~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3181" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_68 #AT_START_69 at_fn_group_banner 69 'input.at:3205' \ "%token-table and parse.error" " " 2 at_xfail=no ( printf "%s\n" "69. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST(DIRECTIVES, ERROR-LOCATION) # ----------------------------------- cat >input.y <<'_ATEOF' %define parse.error custom %token-table %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:3220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-26: error: '%token-table' and '%define parse.error (custom|detailed)' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3220" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %define parse.error detailed %token-table %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3221: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "input.at:3221" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:1.1-28: error: '%token-table' and '%define parse.error (custom|detailed)' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3221" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_69 #AT_START_70 at_fn_group_banner 70 'input.at:3231' \ "Invalid file prefix mapping arguments" " " 2 at_xfail=no ( printf "%s\n" "70. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION) # -------------------------------------------- cat >input.y <<'_ATEOF' %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo input.y" "input.at:3246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":4: error: invalid argument for '--file-prefix-map': foo " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3246" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3247: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --file-prefix-map foo input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --file-prefix-map foo input.y" "input.at:3247" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --file-prefix-map foo input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":4: error: invalid argument for '--file-prefix-map': foo " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3247" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo=bar -M baz input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo=bar -M baz input.y" "input.at:3248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo=bar -M baz input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":6: error: invalid argument for '--file-prefix-map': baz " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3248" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/input.at:3249: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo= -M baz input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo= -M baz input.y" "input.at:3249" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -M foo= -M baz input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ":6: error: invalid argument for '--file-prefix-map': baz " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/input.at:3249" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_70 #AT_START_71 at_fn_group_banner 71 'named-refs.at:22' \ "Tutorial calculator" " " 3 at_xfail=no ( printf "%s\n" "71. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include #include #include typedef int semantic_value; FILE *input; static semantic_value global_result = 0; static int global_count = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %union { semantic_value ival; }; %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ %% input: line | input line {} ; line: '\n' | exp '\n' {} ; exp: NUM { $$ = $NUM; } | exp[l] '=' exp[r] { if ($l != $r) fprintf (stderr, "calc: error: %d != %d\n", $l, $r); $$ = $l; } | exp[x] '+' { $$ = $x; } [l] exp[r] { $$ = $l + $r; } | exp[l] '-' exp[r] { $$ = $l - $r; } | exp[l] '*' exp[r] { $$ = $l * $r; } | exp[l] '/' exp[r] { $$ = $l / $r; } | '-' exp %prec NEG { $$ = -$2; } | exp[l] '^' exp[r] { $$ = power ($l, $r); } | '(' exp[e] ')' { $$ = $e; } | '(' error ')' { $$ = 1111; yyerrok; } | '!' { $$ = 0; YYERROR; } | '-' error { $$ = 0; YYERROR; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int get_char (void) { return getc (input); } static void unget_char (int c) { ungetc (c, input); } static int read_signed_integer (void) { int c = get_char (); int sign = 1; int n = 0; if (c == '-') { c = get_char (); sign = -1; } while (isdigit (c)) { n = 10 * n + (c - '0'); c = get_char (); } unget_char ( c); return sign * n; } static int yylex (void) { int c; /* Skip white space. */ while ((c = get_char ()) == ' ' || c == '\t') {} /* process numbers */ if (c == '.' || isdigit (c)) { unget_char ( c); (yylval).ival = read_signed_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* Return single chars. */ return c; } static int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int status; if (argc == 2) input = fopen (argv[1], "r"); else input = stdin; if (!input) { perror (argv[1]); return 3; } status = yyparse (); fclose (input); assert (global_result == result); (void) global_result; (void) result; assert (global_count == count); (void) global_count; (void) count; return status; } _ATEOF cat >input.txt <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "named-refs.at:184" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "named-refs.at:184" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:184" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "named-refs.at:184" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:184" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "named-refs.at:184" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "named-refs.at:184" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/named-refs.at:184" { set +x printf "%s\n" "$at_srcdir/named-refs.at:184: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "named-refs.at:184" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:184" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:185: \$PREPARSER ./test input.txt" at_fn_check_prepare_dynamic " $PREPARSER ./test input.txt" "named-refs.at:185" ( $at_check_trace; $PREPARSER ./test input.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:185" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:185: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "named-refs.at:185" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:185" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_71 #AT_START_72 at_fn_group_banner 72 'named-refs.at:196' \ "Undefined and ambiguous references" " " 3 at_xfail=no ( printf "%s\n" "72. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %union { int ival; }; %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ %% input: line | input line {} ; line: '\n' | exp '\n' {} ; exp: NUM { $$ = $NUM; } | exp[l] '=' exp[r] { if ($l != $r) fprintf (stderr, "calc: error: %d != %d\n", $l, $r); $$ = $l; } | exp[x] '+' { $$ = $x; } [l] exp[r] { $$ = $lo9 + $r; } | exp[x] '-' { $$ = $x; } [l] exp[r] { $$ = $exp - $r; } | exp[x] '*' { $$ = $x; } [l] exp[r] { $$ = $l * $r; } | exp[l] '/' exp[r] { $$ = $l / $r; } | '-' exp %prec NEG { $$ = -$2; } | exp[l] '^' exp[r] { $$ = power ($l, $r12); } | '(' exp ')' { $$ = $expo; } | '(' error ')' { $$ = 1111; yyerrok; } | '!' { $$ = 0; YYERROR; } | '-' error { $$ = 0; YYERROR; } ; %% _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:254: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o test.c test.y" "named-refs.at:254" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:52.51-60: error: invalid reference: '\$lo9' 52 | | exp[x] '+' { \$\$ = \$x; } [l] exp[r] { \$\$ = \$lo9 + \$r; } | ^~~~~~~~~~ test.y:52.3-68: note: symbol not found in production: lo9 52 | | exp[x] '+' { \$\$ = \$x; } [l] exp[r] { \$\$ = \$lo9 + \$r; } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:53.51-60: warning: misleading reference: '\$exp' [-Wother] 53 | | exp[x] '-' { \$\$ = \$x; } [l] exp[r] { \$\$ = \$exp - \$r; } | ^~~~~~~~~~ test.y:44.1-3: note: refers to: \$exp at \$\$ 44 | exp: | ^~~ test.y:53.7: note: possibly meant: \$x, hiding \$exp at \$1 53 | | exp[x] '-' { \$\$ = \$x; } [l] exp[r] { \$\$ = \$exp - \$r; } | ^ test.y:53.41: note: possibly meant: \$r, hiding \$exp at \$4 53 | | exp[x] '-' { \$\$ = \$x; } [l] exp[r] { \$\$ = \$exp - \$r; } | ^ test.y:54.51-52: error: \$l of 'exp' has no declared type 54 | | exp[x] '*' { \$\$ = \$x; } [l] exp[r] { \$\$ = \$l * \$r; } | ^~ test.y:57.40-43: error: invalid reference: '\$r12' 57 | | exp[l] '^' exp[r] { \$\$ = power (\$l, \$r12); } | ^~~~ test.y:57.3-47: note: symbol not found in production: r12 57 | | exp[l] '^' exp[r] { \$\$ = power (\$l, \$r12); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:58.29-33: error: invalid reference: '\$expo' 58 | | '(' exp ')' { \$\$ = \$expo; } | ^~~~~ test.y:58.3-46: note: symbol not found in production: expo 58 | | '(' exp ')' { \$\$ = \$expo; } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:254" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_72 #AT_START_73 at_fn_group_banner 73 'named-refs.at:297' \ "Misleading references" " " 3 at_xfail=no ( printf "%s\n" "73. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start: foo foo.bar { $foo.bar; } foo: '1' foo.bar: '2' _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:306" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "named-refs.at:306" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:306" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:11.22-29: warning: misleading reference: '\$foo.bar' [-Wother] test.y:11.8-10: note: refers to: \$foo at \$1 test.y:11.12-18: note: possibly meant: \$[foo.bar] at \$2 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y -Werror" "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' test.y:11.22-29: warning: misleading reference: '$foo.bar' [-Wother] test.y:11.8-10: note: refers to: $foo at $1 test.y:11.12-18: note: possibly meant: $[foo.bar] at $2 _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "named-refs.at:306" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y --warnings=error" "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y -Wnone,none -Werror --trace=none" "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:306: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y --warnings=none -Werror --trace=none" "named-refs.at:306" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:306" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_73 #AT_START_74 at_fn_group_banner 74 'named-refs.at:316' \ "Many kinds of errors" " " 3 at_xfail=no ( printf "%s\n" "74. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token IDENT %token NUMBER %token ASSIGNOP %token IF %token IF1 %token THEN %token ELSE %token FI %token WHILE %token DO %token OD %start program %% if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI { $if_stmt1 = new IfStmt($cond1, $then.f1, $else); }; if_stmt2: IF expr[cond] THEN stmt[then] FI { $if_stmt2 = new IfStmt($cond, $stmt.field, 0); }; if_stmt3: IF expr[cond] THEN stmt.list FI { $if_stmt3 = new IfStmt($cond, $stmt.list, 0); }; if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI { $if_stmt4 = new IfStmt($cond, $xyz, $cond); }; if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI { $if_stmt5 = new IfStmt($cond, $stmt.list, $else); }; if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI { $if_stmt6 = new IfStmt($cond, $stmt.list.field, $else); }; if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI { $if_stmt7 = new IfStmt($cond, $[stmt.list].field, $else); }; if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI { $if_stmt8 = new IfStmt($cond, $then.1, $else); }; if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI { $if_stmt9 = new IfStmt($cond, $then.1.field, $else); }; if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI { $if_stmt10 = new IfStmt($cond, $stmt.x, 0); }; if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI { $if-stmt-a = new IfStmt($cond, $then, $else); }; if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI { $[if-stmt-b] = new IfStmt($cond, $then-a.f, $else); }; program: stmt.list; stmt.list: stmt ';' stmt.list { $3->insert($stmt); $$ = $3; } | stmt ';' { SL = new StmtList(); SL->insert($1); $$ = SL; } ; stmt: assign_stmt { $$ = $1; } | if_stmt { $$ = $1; } | if_stmt1 { $$ = $1; } | while_stmt { $$ = $1; } ; assign_stmt: IDENT ASSIGNOP expr { $$ = new AssignStmt(string($1),$3); }; if_stmt: IF expr[cond] THEN stmt.list FI { $if_stmt = new IfStmt($cond, $[stmt.list], 0); }; while_stmt[res]: WHILE expr DO stmt.list OD { $res = new WhileStmt($[expr], $[stmt.list]); }; expr: expr '+' term { $$ = new Plus($1,$3); } | expr '-' term { $$ = new Minus($1,$3); } | term { $$ = $1; } ; term: term '*' factor { $$ = new Times($1,$3); } | factor { $$ = $1; } ; factor: '(' expr ')' { $$ = $2; } | NUMBER { $$ = new Number($1); } | IDENT { $$ = new Ident(string($1)); } ; _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:384: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:384" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:24.36-41: error: invalid reference: '\$cond1' test.y:23.11-24.62: note: symbol not found in production: cond1 test.y:26.43-53: error: invalid reference: '\$stmt.field' test.y:25.11-26.60: note: symbol not found in production: stmt test.y:25.35-38: note: possibly meant: \$then.field, hiding \$stmt.field at \$4 test.y:28.43-52: error: invalid reference: '\$stmt.list' test.y:27.11-28.59: note: symbol not found in production: stmt test.y:27.30-38: note: possibly meant: \$[stmt.list] at \$4 test.y:30.43-46: error: ambiguous reference: '\$xyz' test.y:29.35-37: note: refers to: \$xyz at \$4 test.y:29.50-52: note: refers to: \$xyz at \$6 test.y:32.43-52: error: invalid reference: '\$stmt.list' test.y:31.11-32.63: note: symbol not found in production: stmt test.y:31.40-43: note: possibly meant: \$then, hiding \$[stmt.list] at \$4 test.y:31.61-64: note: possibly meant: \$else, hiding \$[stmt.list] at \$6 test.y:34.43-58: error: invalid reference: '\$stmt.list.field' test.y:33.11-34.69: note: symbol not found in production: stmt test.y:33.40-43: note: possibly meant: \$then.field, hiding \$[stmt.list].field at \$4 test.y:33.61-64: note: possibly meant: \$else.field, hiding \$[stmt.list].field at \$6 test.y:36.43-54: error: invalid reference: '\$[stmt.list]' test.y:35.11-36.71: note: symbol not found in production: stmt.list test.y:35.40-43: note: possibly meant: \$then, hiding \$[stmt.list] at \$4 test.y:35.61-64: note: possibly meant: \$else, hiding \$[stmt.list] at \$6 test.y:38.43-49: error: invalid reference: '\$then.1' test.y:37.11-38.60: note: symbol not found in production: then test.y:37.40-45: note: possibly meant: \$[then.1] at \$4 test.y:40.43-55: error: invalid reference: '\$then.1.field' test.y:39.11-40.66: note: symbol not found in production: then test.y:39.40-45: note: possibly meant: \$[then.1].field at \$4 test.y:42.44-50: error: invalid reference: '\$stmt.x' test.y:41.12-42.57: note: symbol not found in production: stmt test.y:41.36-41: note: possibly meant: \$[stmt.x].x, hiding \$stmt.x at \$4 test.y:41.36-41: note: possibly meant: \$[stmt.x] at \$4 test.y:44.13-22: error: invalid reference: '\$if-stmt-a' test.y:43.12-44.59: note: symbol not found in production: if test.y:43.1-9: note: possibly meant: \$[if-stmt-a] at \$\$ test.y:46.46-54: error: invalid reference: '\$then-a.f' test.y:45.12-46.65: note: symbol not found in production: then test.y:45.41-46: note: possibly meant: \$[then-a].f at \$4 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:384" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:426: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o test.c test.y" "named-refs.at:426" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:24.36-41: error: invalid reference: '\$cond1' 24 | { \$if_stmt1 = new IfStmt(\$cond1, \$then.f1, \$else); }; | ^~~~~~ test.y:23.11-24.62: note: symbol not found in production: cond1 23 | if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:26.43-53: error: invalid reference: '\$stmt.field' 26 | { \$if_stmt2 = new IfStmt(\$cond, \$stmt.field, 0); }; | ^~~~~~~~~~~ test.y:25.11-26.60: note: symbol not found in production: stmt 25 | if_stmt2: IF expr[cond] THEN stmt[then] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:25.35-38: note: possibly meant: \$then.field, hiding \$stmt.field at \$4 25 | if_stmt2: IF expr[cond] THEN stmt[then] FI | ^~~~ test.y:28.43-52: error: invalid reference: '\$stmt.list' 28 | { \$if_stmt3 = new IfStmt(\$cond, \$stmt.list, 0); }; | ^~~~~~~~~~ test.y:27.11-28.59: note: symbol not found in production: stmt 27 | if_stmt3: IF expr[cond] THEN stmt.list FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:27.30-38: note: possibly meant: \$[stmt.list] at \$4 27 | if_stmt3: IF expr[cond] THEN stmt.list FI | ^~~~~~~~~ test.y:30.43-46: error: ambiguous reference: '\$xyz' 30 | { \$if_stmt4 = new IfStmt(\$cond, \$xyz, \$cond); }; | ^~~~ test.y:29.35-37: note: refers to: \$xyz at \$4 29 | if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI | ^~~ test.y:29.50-52: note: refers to: \$xyz at \$6 29 | if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI | ^~~ test.y:32.43-52: error: invalid reference: '\$stmt.list' 32 | { \$if_stmt5 = new IfStmt(\$cond, \$stmt.list, \$else); }; | ^~~~~~~~~~ test.y:31.11-32.63: note: symbol not found in production: stmt 31 | if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:31.40-43: note: possibly meant: \$then, hiding \$[stmt.list] at \$4 31 | if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~ test.y:31.61-64: note: possibly meant: \$else, hiding \$[stmt.list] at \$6 31 | if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~ test.y:34.43-58: error: invalid reference: '\$stmt.list.field' 34 | { \$if_stmt6 = new IfStmt(\$cond, \$stmt.list.field, \$else); }; | ^~~~~~~~~~~~~~~~ test.y:33.11-34.69: note: symbol not found in production: stmt 33 | if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:33.40-43: note: possibly meant: \$then.field, hiding \$[stmt.list].field at \$4 33 | if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~ test.y:33.61-64: note: possibly meant: \$else.field, hiding \$[stmt.list].field at \$6 33 | if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~ test.y:36.43-54: error: invalid reference: '\$[stmt.list]' 36 | { \$if_stmt7 = new IfStmt(\$cond, \$[stmt.list].field, \$else); }; | ^~~~~~~~~~~~ test.y:35.11-36.71: note: symbol not found in production: stmt.list 35 | if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:35.40-43: note: possibly meant: \$then, hiding \$[stmt.list] at \$4 35 | if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~ test.y:35.61-64: note: possibly meant: \$else, hiding \$[stmt.list] at \$6 35 | if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~ test.y:38.43-49: error: invalid reference: '\$then.1' 38 | { \$if_stmt8 = new IfStmt(\$cond, \$then.1, \$else); }; | ^~~~~~~ test.y:37.11-38.60: note: symbol not found in production: then 37 | if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:37.40-45: note: possibly meant: \$[then.1] at \$4 37 | if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI | ^~~~~~ test.y:40.43-55: error: invalid reference: '\$then.1.field' 40 | { \$if_stmt9 = new IfStmt(\$cond, \$then.1.field, \$else); }; | ^~~~~~~~~~~~~ test.y:39.11-40.66: note: symbol not found in production: then 39 | if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:39.40-45: note: possibly meant: \$[then.1].field at \$4 39 | if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI | ^~~~~~ test.y:42.44-50: error: invalid reference: '\$stmt.x' 42 | { \$if_stmt10 = new IfStmt(\$cond, \$stmt.x, 0); }; | ^~~~~~~ test.y:41.12-42.57: note: symbol not found in production: stmt 41 | if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:41.36-41: note: possibly meant: \$[stmt.x].x, hiding \$stmt.x at \$4 41 | if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI | ^~~~~~ test.y:41.36-41: note: possibly meant: \$[stmt.x] at \$4 41 | if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI | ^~~~~~ test.y:44.13-22: error: invalid reference: '\$if-stmt-a' 44 | { \$if-stmt-a = new IfStmt(\$cond, \$then, \$else); }; | ^~~~~~~~~~ test.y:43.12-44.59: note: symbol not found in production: if 43 | if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:43.1-9: note: possibly meant: \$[if-stmt-a] at \$\$ 43 | if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI | ^~~~~~~~~ test.y:46.46-54: error: invalid reference: '\$then-a.f' 46 | { \$[if-stmt-b] = new IfStmt(\$cond, \$then-a.f, \$else); }; | ^~~~~~~~~ test.y:45.12-46.65: note: symbol not found in production: then 45 | if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.y:45.41-46: note: possibly meant: \$[then-a].f at \$4 45 | if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI | ^~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:426" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_74 #AT_START_75 at_fn_group_banner 75 'named-refs.at:551' \ "Missing identifiers in brackets" " " 3 at_xfail=no ( printf "%s\n" "75. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start: foo[] bar { s = $foo; } _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:559: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:559" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:11.12: error: an identifier expected " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:559" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_75 #AT_START_76 at_fn_group_banner 76 'named-refs.at:567' \ "Redundant words in brackets" " " 3 at_xfail=no ( printf "%s\n" "76. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start: foo[ a d ] bar { s = $foo; } _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:575: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:575" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:11.15: error: unexpected identifier in bracketed name: 'd' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:575" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_76 #AT_START_77 at_fn_group_banner 77 'named-refs.at:583' \ "Comments in brackets" " " 3 at_xfail=no ( printf "%s\n" "77. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start: foo[/* comment */] bar { s = $foo; } _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:591: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:591" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:11.25: error: an identifier expected " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:591" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_77 #AT_START_78 at_fn_group_banner 78 'named-refs.at:599' \ "Stray symbols in brackets" " " 3 at_xfail=no ( printf "%s\n" "78. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start: foo[ % /* aaa */ *&-.+\000\001\002\377 ] bar { s = $foo; } _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:607: \"\$PERL\" -pi -e 's/\\\\(\\d{3})/chr(oct(\$1))/ge' test.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's/\\\\(\\d{3})/chr(oct($1))/ge' test.y || exit 77" "named-refs.at:607" ( $at_check_trace; "$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:607" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:608: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:608" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:11.13: error: invalid character in bracketed name: '%' test.y:11.25-27: error: invalid characters in bracketed name: '*&-' test.y:11.29-30: error: invalid characters in bracketed name: '+\\0\\001\\002\\377' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:608" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_78 #AT_START_79 at_fn_group_banner 79 'named-refs.at:618' \ "Redundant words in LHS brackets" " " 3 at_xfail=no ( printf "%s\n" "79. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start[a s]: foo; _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:625: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:625" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:11.9: error: unexpected identifier in bracketed name: 's' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:625" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_79 #AT_START_80 at_fn_group_banner 80 'named-refs.at:635' \ "Factored LHS" " " 3 at_xfail=no ( printf "%s\n" "80. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% start[a]: "foo" | "bar"; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/named-refs.at:642: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "named-refs.at:642" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:642" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:642: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "named-refs.at:642" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:642" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:642: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:642" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:642" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/named-refs.at:642: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "named-refs.at:642" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:642" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:642: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:642" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:642" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/named-refs.at:642: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "named-refs.at:642" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:642" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_80 #AT_START_81 at_fn_group_banner 81 'named-refs.at:648' \ "Unresolved references" " " 3 at_xfail=no ( printf "%s\n" "81. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% stat: sym_a sym_b { func($sym.field); } | sym_a sym_b { func($sym.field); } | sym_a sym_b { func($[sym.field]); } | sym_a sym_b { func($[sym.field]); } | sym_a sym_b { func($sym); } | sym_a sym_b { func($sym); } | sym_a sym_b { func($[sym]); } sym_a sym_b { func($[sym]); } ; stat1: sym_a sym_b { func($sym-field); } | sym_a sym_b { func($sym-field); } | sym_a sym_b { func($[sym-field]); } | sym_a sym_b { func($[sym-field]); } | sym_a sym_b { func($sym); } | sym_a sym_b { func($sym); } | sym_a sym_b { func($[sym]); } sym_a sym_b { func($[sym]); } ; sym_a: 'a'; sym_b: 'b'; _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:676: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y" "named-refs.at:676" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:12.22-31: error: invalid reference: '\$sym.field' test.y:12.3-35: note: symbol not found in production: sym test.y:13.22-35: error: invalid reference: '\$sym.field' test.y:13.3-39: note: symbol not found in production: sym test.y:14.22-33: error: invalid reference: '\$[sym.field]' test.y:14.3-37: note: symbol not found in production: sym.field test.y:15.22-37: error: invalid reference: '\$[sym.field]' test.y:15.3-41: note: symbol not found in production: sym.field test.y:16.22-25: error: invalid reference: '\$sym' test.y:16.3-29: note: symbol not found in production: sym test.y:17.22-29: error: invalid reference: '\$sym' test.y:17.3-33: note: symbol not found in production: sym test.y:18.22-27: error: invalid reference: '\$[sym]' test.y:18.3-65: note: symbol not found in production before \$3: sym test.y:18.52-61: error: invalid reference: '\$[sym]' test.y:18.3-65: note: symbol not found in production: sym test.y:22.22-31: error: invalid reference: '\$sym-field' test.y:22.3-35: note: symbol not found in production: sym test.y:23.22-35: error: invalid reference: '\$sym-field' test.y:23.3-39: note: symbol not found in production: sym test.y:24.22-33: error: invalid reference: '\$[sym-field]' test.y:24.3-37: note: symbol not found in production: sym-field test.y:25.22-37: error: invalid reference: '\$[sym-field]' test.y:25.3-41: note: symbol not found in production: sym-field test.y:26.22-25: error: invalid reference: '\$sym' test.y:26.3-29: note: symbol not found in production: sym test.y:27.22-29: error: invalid reference: '\$sym' test.y:27.3-33: note: symbol not found in production: sym test.y:28.22-27: error: invalid reference: '\$[sym]' test.y:28.3-65: note: symbol not found in production before \$3: sym test.y:28.52-61: error: invalid reference: '\$[sym]' test.y:28.3-65: note: symbol not found in production: sym " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:676" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_81 #AT_START_82 at_fn_group_banner 82 'named-refs.at:715' \ "\$ or @ followed by . or -" " " 3 at_xfail=no ( printf "%s\n" "82. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %% start: .field { $.field; } | 'a' { @.field; } ; .field: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/named-refs.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y" "named-refs.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:4.12-18: error: invalid reference: '\$.field' test.y:4.13: note: syntax error after '\$', expecting integer, letter, '_', '[', or '\$' test.y:4.3-8: note: possibly meant: \$[.field] at \$1 test.y:5.12-18: error: invalid reference: '@.field' test.y:5.13: note: syntax error after '@', expecting integer, letter, '_', '[', or '\$' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:725" $at_failed && at_fn_log_failure $at_traceon; } cat >test.y <<'_ATEOF' %% start: 'a' { $-field; } | 'b' { @-field; } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv test.y" at_fn_check_prepare_notrace 'an embedded newline' "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml test.y" "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:740" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "named-refs.at:740" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "named-refs.at:740" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret test.y" at_fn_check_prepare_trace "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "test.y:4.9: warning: stray '\$' [-Wother] test.y:5.9: warning: stray '@' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y -Werror" "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' test.y:4.9: warning: stray '$' [-Wother] test.y:5.9: warning: stray '@' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "named-refs.at:740" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y --warnings=error" "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y -Wnone,none -Werror --trace=none" "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/named-refs.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y --warnings=none -Werror --trace=none" "named-refs.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret test.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/named-refs.at:740" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_82 #AT_START_83 at_fn_group_banner 83 'output.at:68' \ "Output files: -dv" " " 4 at_xfail=no ( printf "%s\n" "83. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.output foo.tab.c foo.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:68: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:68" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:68: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:68" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv foo.y" "output.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:68: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:68" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:68: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:68" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:68: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:68" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv foo.y" at_fn_check_prepare_trace "output.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:68: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:68" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.c foo.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:68" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_83 #AT_START_84 at_fn_group_banner 84 'output.at:74' \ "Output files: -dv >&-" " " 4 at_xfail=no ( printf "%s\n" "84. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/output.at:74: case \"\$PREBISON\" in *valgrind*) exit 77;; esac" at_fn_check_prepare_dynamic "case \"$PREBISON\" in *valgrind*) exit 77;; esac" "output.at:74" ( $at_check_trace; case "$PREBISON" in *valgrind*) exit 77;; esac ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } for file in foo.y foo.output foo.tab.c foo.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:74: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:74" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:74: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:74" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv >&- foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv >&- foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv >&- foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv >&- foo.y" "output.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv >&- foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:74: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:74" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv >&- foo.y" at_fn_check_prepare_trace "output.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv >&- foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:74: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:74" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.c foo.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:74" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_84 #AT_START_85 at_fn_group_banner 85 'output.at:81' \ "Output files: -dv -o foo.c" " " 4 at_xfail=no ( printf "%s\n" "85. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.c foo.h foo.output; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:81: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:81" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:81: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:81" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:81: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -o foo.c foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:81" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -o foo.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:81: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -o foo.c foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -o foo.c foo.y" "output.at:81" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -o foo.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:81: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:81" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:81: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:81" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:81: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:81" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:81: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -o foo.c foo.y" at_fn_check_prepare_trace "output.at:81" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -o foo.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:81: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:81" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c foo.h foo.output " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:81: grep '#include \"foo.h\"' foo.c" at_fn_check_prepare_trace "output.at:81" ( $at_check_trace; grep '#include "foo.h"' foo.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:81" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_85 #AT_START_86 at_fn_group_banner 86 'output.at:84' \ "Output files: -dv -y" " " 4 at_xfail=no ( printf "%s\n" "86. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.output y.tab.c y.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:84: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:84" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:84: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:84" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:84: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -y foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:84" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:84: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -y foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -y foo.y" "output.at:84" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:84: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:84" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:84: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:84" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:84: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:84" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:84: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -y foo.y" at_fn_check_prepare_trace "output.at:84" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:84: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:84" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.output y.tab.c y.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:84: grep '#include \"y.tab.h\"' y.tab.c" at_fn_check_prepare_trace "output.at:84" ( $at_check_trace; grep '#include "y.tab.h"' y.tab.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/output.at:84" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_86 #AT_START_87 at_fn_group_banner 87 'output.at:87' \ "Output files: api.header.include={\"./foo.h\"} -dv -y" "" 4 at_xfail=no ( printf "%s\n" "87. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.output y.tab.c y.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %define api.header.include {"./foo.h"} %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:87: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:87" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:87: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:87" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:87: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -y foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:87" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:87: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -y foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -y foo.y" "output.at:87" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:87: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:87" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:87: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:87" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:87: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:87" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:87: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -y foo.y" at_fn_check_prepare_trace "output.at:87" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:87: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:87" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.output y.tab.c y.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:87: grep '#include \"./foo.h\"' y.tab.c" at_fn_check_prepare_trace "output.at:87" ( $at_check_trace; grep '#include "./foo.h"' y.tab.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:87" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_87 #AT_START_88 at_fn_group_banner 88 'output.at:92' \ "Output files: -dv -o foo.tab.c" " " 4 at_xfail=no ( printf "%s\n" "88. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.output foo.tab.c foo.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:92: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:92" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:92: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:92" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:92: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -o foo.tab.c foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:92" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -o foo.tab.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:92: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -o foo.tab.c foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -o foo.tab.c foo.y" "output.at:92" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -o foo.tab.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:92: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:92" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:92: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:92" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:92: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:92" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:92: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -o foo.tab.c foo.y" at_fn_check_prepare_trace "output.at:92" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -o foo.tab.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:92: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:92" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.c foo.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:92" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_88 #AT_START_89 at_fn_group_banner 89 'output.at:95' \ "Output files: --fixed-output-files -dv -g --html" "" 4 at_xfail=no ( printf "%s\n" "89. $at_setup_line: testing $at_desc ..." $at_traceon printf "%s\n" "output.at:95" >"$at_check_line_file" (test x"$XSLTPROC" = x) \ && at_fn_check_skip 77 "$at_srcdir/output.at:95" for file in foo.y y.gv y.html y.output y.tab.c y.tab.h y.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:95: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:95" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:95: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:95" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:95: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --fixed-output-files -dv -g --html foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:95" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --fixed-output-files -dv -g --html foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:95: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --fixed-output-files -dv -g --html foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --fixed-output-files -dv -g --html foo.y" "output.at:95" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --fixed-output-files -dv -g --html foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:95: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:95" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:95: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:95" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:95: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:95" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:95: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --fixed-output-files -dv -g --html foo.y" at_fn_check_prepare_trace "output.at:95" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --fixed-output-files -dv -g --html foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:95: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:95" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.gv y.html y.output y.tab.c y.tab.h y.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:95" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_89 #AT_START_90 at_fn_group_banner 90 'output.at:97' \ "Output files: -Hfoo.header -v -gfoo.gv --html=foo.html" "" 4 at_xfail=no ( printf "%s\n" "90. $at_setup_line: testing $at_desc ..." $at_traceon printf "%s\n" "output.at:97" >"$at_check_line_file" (test x"$XSLTPROC" = x) \ && at_fn_check_skip 77 "$at_srcdir/output.at:97" for file in foo.y foo.gv foo.header foo.html foo.output foo.tab.c foo.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:97: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:97" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:97: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:97" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:97: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Hfoo.header -v -gfoo.gv --html=foo.html foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:97" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Hfoo.header -v -gfoo.gv --html=foo.html foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:97: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Hfoo.header -v -gfoo.gv --html=foo.html foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Hfoo.header -v -gfoo.gv --html=foo.html foo.y" "output.at:97" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Hfoo.header -v -gfoo.gv --html=foo.html foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:97: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:97" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:97: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:97" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:97: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:97" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:97: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Hfoo.header -v -gfoo.gv --html=foo.html foo.y" at_fn_check_prepare_trace "output.at:97" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Hfoo.header -v -gfoo.gv --html=foo.html foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:97: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:97" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.gv foo.header foo.html foo.output foo.tab.c foo.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:97" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_90 #AT_START_91 at_fn_group_banner 91 'output.at:100' \ "Output files: -dv -g --xml --fixed-output-files" "" 4 at_xfail=no ( printf "%s\n" "91. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.gv y.output y.tab.c y.tab.h y.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:100: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:100" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:100: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:100" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:100: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -g --xml --fixed-output-files foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:100" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -g --xml --fixed-output-files foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:100: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml --fixed-output-files foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml --fixed-output-files foo.y" "output.at:100" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml --fixed-output-files foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:100: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:100" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:100: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:100" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:100: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:100" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:100: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml --fixed-output-files foo.y" at_fn_check_prepare_trace "output.at:100" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml --fixed-output-files foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:100: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:100" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.gv y.output y.tab.c y.tab.h y.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:100" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_91 #AT_START_92 at_fn_group_banner 92 'output.at:102' \ "Output files: -dv -g --xml -y" " " 4 at_xfail=no ( printf "%s\n" "92. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.gv y.output y.tab.c y.tab.h y.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:102: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:102" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:102: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:102" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:102: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -g --xml -y foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:102" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -g --xml -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:102: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -y foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -y foo.y" "output.at:102" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:102: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:102" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:102: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:102" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:102: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:102" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:102: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml -y foo.y" at_fn_check_prepare_trace "output.at:102" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:102: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:102" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.gv y.output y.tab.c y.tab.h y.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:102" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_92 #AT_START_93 at_fn_group_banner 93 'output.at:104' \ "Output files: %require \"3.4\" -dv -g --xml -y" " " 4 at_xfail=no ( printf "%s\n" "93. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.gv y.output y.tab.c y.tab.h y.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %require "3.4" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:104: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:104" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:104: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:104" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:104: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -g --xml -y foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:104" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -g --xml -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:104: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -y foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -y foo.y" "output.at:104" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:104: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:104" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:104: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:104" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:104: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:104" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:104: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml -y foo.y" at_fn_check_prepare_trace "output.at:104" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml -y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:104: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:104" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.gv y.output y.tab.c y.tab.h y.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:104" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_93 #AT_START_94 at_fn_group_banner 94 'output.at:107' \ "Output files: -dv -g --xml -o y.tab.c" " " 4 at_xfail=no ( printf "%s\n" "94. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.gv y.output y.tab.c y.tab.h y.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:107: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:107" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:107: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:107" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:107: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -g --xml -o y.tab.c foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:107" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -g --xml -o y.tab.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:107: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -o y.tab.c foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -o y.tab.c foo.y" "output.at:107" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g --xml -o y.tab.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:107: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:107" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:107: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:107" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:107: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:107" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:107: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml -o y.tab.c foo.y" at_fn_check_prepare_trace "output.at:107" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g --xml -o y.tab.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:107: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:107" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.gv y.output y.tab.c y.tab.h y.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:107" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_94 #AT_START_95 at_fn_group_banner 95 'output.at:110' \ "Output files: -dv -b bar" " " 4 at_xfail=no ( printf "%s\n" "95. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y bar.output bar.tab.c bar.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:110: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:110" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:110: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:110" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:110: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -b bar foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:110" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -b bar foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:110: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -b bar foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -b bar foo.y" "output.at:110" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -b bar foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:110: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:110" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:110: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:110" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:110: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:110" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:110: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -b bar foo.y" at_fn_check_prepare_trace "output.at:110" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -b bar foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:110: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:110" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "bar.output bar.tab.c bar.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:110" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_95 #AT_START_96 at_fn_group_banner 96 'output.at:112' \ "Output files: -dv -g -o foo.c" " " 4 at_xfail=no ( printf "%s\n" "96. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.c foo.gv foo.h foo.output; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:112: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:112" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:112: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:112" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:112: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -dv -g -o foo.c foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:112" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -dv -g -o foo.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:112: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g -o foo.c foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g -o foo.c foo.y" "output.at:112" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -dv -g -o foo.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:112: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:112" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:112: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:112" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:112: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:112" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:112: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g -o foo.c foo.y" at_fn_check_prepare_trace "output.at:112" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -dv -g -o foo.c foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:112: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:112" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c foo.gv foo.h foo.output " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:112" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_96 #AT_START_97 at_fn_group_banner 97 'output.at:116' \ "Output files: %header %verbose " " " 4 at_xfail=no ( printf "%s\n" "97. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.output foo.tab.c foo.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %header %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:116: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:116" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:116: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:116" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" "output.at:116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:116: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:116" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:116: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:116" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:116: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:116" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y" at_fn_check_prepare_trace "output.at:116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:116: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:116" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.c foo.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:116" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_97 #AT_START_98 at_fn_group_banner 98 'output.at:118' \ "Output files: %header %verbose %yacc " " " 4 at_xfail=no ( printf "%s\n" "98. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y y.output y.tab.c y.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %header %verbose %yacc %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:118: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:118" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:118: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:118" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:118: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:118" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:118: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" "output.at:118" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:118: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:118" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:118: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:118" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:118: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:118" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:118: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y" at_fn_check_prepare_trace "output.at:118" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:118: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:118" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.output y.tab.c y.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:118" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_98 #AT_START_99 at_fn_group_banner 99 'output.at:121' \ "Output files: %header %verbose %yacc " " " 4 at_xfail=no ( printf "%s\n" "99. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy y.output y.tab.c y.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %header %verbose %yacc %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:121: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:121" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:121: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:121" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:121: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:121" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:121: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:121" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:121: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:121" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:121: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:121" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:121: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:121" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:121: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:121" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:121: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:121" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "y.output y.tab.c y.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:121" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_99 #AT_START_100 at_fn_group_banner 100 'output.at:125' \ "Output files: %file-prefix \"bar\" %header %verbose " "" 4 at_xfail=no ( printf "%s\n" "100. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y bar.output bar.tab.c bar.tab.h; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %file-prefix "bar" %header %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:125: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:125" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:125: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:125" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:125: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:125" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:125: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" "output.at:125" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:125: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:125" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:125: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:125" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:125: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:125" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:125: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y" at_fn_check_prepare_trace "output.at:125" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:125: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:125" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "bar.output bar.tab.c bar.tab.h " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:125" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_100 #AT_START_101 at_fn_group_banner 101 'output.at:127' \ "Output files: %output \"bar.c\" %header %verbose %yacc " "" 4 at_xfail=no ( printf "%s\n" "101. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y bar.c bar.h bar.output; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %output "bar.c" %header %verbose %yacc %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:127: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:127" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:127: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:127" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:127: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:127" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:127: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" "output.at:127" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:127: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:127" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:127: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:127" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:127: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:127" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:127: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y" at_fn_check_prepare_trace "output.at:127" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:127: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:127" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "bar.c bar.h bar.output " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:127" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_101 #AT_START_102 at_fn_group_banner 102 'output.at:129' \ "Output files: %file-prefix \"baz\" %output \"bar.c\" %header %verbose %yacc " "" 4 at_xfail=no ( printf "%s\n" "102. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y bar.c bar.h bar.output; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %file-prefix "baz" %output "bar.c" %header %verbose %yacc %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:129: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:129" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:129: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:129" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:129: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:129" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:129: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y" "output.at:129" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:129: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:129" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:129: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:129" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:129: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:129" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:129: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y" at_fn_check_prepare_trace "output.at:129" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:129: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:129" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "bar.c bar.h bar.output " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:129" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_102 #AT_START_103 at_fn_group_banner 103 'output.at:136' \ "Output files: %header %verbose " " " 4 at_xfail=no ( printf "%s\n" "103. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.output foo.tab.cc foo.tab.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %header %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:136: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:136" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:136: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:136" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:136: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:136" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:136: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:136" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:136: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:136" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:136: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:136" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:136: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:136" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:136: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:136" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:136: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:136" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.cc foo.tab.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:136" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_103 #AT_START_104 at_fn_group_banner 104 'output.at:139' \ "Output files: %header %verbose -o foo.c" " " 4 at_xfail=no ( printf "%s\n" "104. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c foo.h foo.output; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %header %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:139: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:139" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:139: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:139" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o foo.c foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o foo.c foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c foo.yy" "output.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c foo.yy" at_fn_check_prepare_trace "output.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:139: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:139" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c foo.h foo.output " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_104 #AT_START_105 at_fn_group_banner 105 'output.at:142' \ "Output files: --header=foo.hpp -o foo.c++" " " 4 at_xfail=no ( printf "%s\n" "105. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c++ foo.hpp; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:142: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:142" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:142: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:142" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:142: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --header=foo.hpp -o foo.c++ foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:142" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --header=foo.hpp -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:142: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header=foo.hpp -o foo.c++ foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header=foo.hpp -o foo.c++ foo.yy" "output.at:142" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header=foo.hpp -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:142: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:142" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:142: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:142" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:142: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:142" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:142: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --header=foo.hpp -o foo.c++ foo.yy" at_fn_check_prepare_trace "output.at:142" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --header=foo.hpp -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:142: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:142" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c++ foo.hpp " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:142" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_105 #AT_START_106 at_fn_group_banner 106 'output.at:146' \ "Output files: --header=foo.hpp -o foo.c++" " " 4 at_xfail=no ( printf "%s\n" "106. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c++ foo.hpp; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:146: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:146" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:146: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:146" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --header=foo.hpp -o foo.c++ foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --header=foo.hpp -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header=foo.hpp -o foo.c++ foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header=foo.hpp -o foo.c++ foo.yy" "output.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header=foo.hpp -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:146: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:146" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:146: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:146" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:146: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:146" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --header=foo.hpp -o foo.c++ foo.yy" at_fn_check_prepare_trace "output.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --header=foo.hpp -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:146: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:146" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c++ foo.hpp " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:146" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_106 #AT_START_107 at_fn_group_banner 107 'output.at:150' \ "Output files: %header \"foo.hpp\" -o foo.c++" " " 4 at_xfail=no ( printf "%s\n" "107. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c++ foo.hpp; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %header "foo.hpp" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:150: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:150" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:150: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:150" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:150: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o foo.c++ foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:150" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:150: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" "output.at:150" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:150: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:150" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:150: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:150" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:150: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:150" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:150: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ foo.yy" at_fn_check_prepare_trace "output.at:150" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:150: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:150" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c++ foo.hpp " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:150" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_107 #AT_START_108 at_fn_group_banner 108 'output.at:154' \ "Output files: -o foo.c++ --graph=foo.gph" " " 4 at_xfail=no ( printf "%s\n" "108. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c++ foo.gph; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:154: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:154" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:154: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:154" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:154: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o foo.c++ foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:154" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:154: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" "output.at:154" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:154: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:154" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:154: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:154" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:154: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:154" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:154: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ --graph=foo.gph foo.yy" at_fn_check_prepare_trace "output.at:154" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ --graph=foo.gph foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:154: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:154" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c++ foo.gph " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:154" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_108 #AT_START_109 at_fn_group_banner 109 'output.at:160' \ "Output files: %type useless --header --graph --xml --report=all -Wall -Werror" "" 4 at_xfail=no ( printf "%s\n" "109. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.gv foo.output foo.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %type useless %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:160: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:160" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:160" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:160: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:160" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:160" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/output.at:160: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header --graph --xml --report=all -Wall -Werror foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header --graph --xml --report=all -Wall -Werror foo.y" "output.at:160" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --header --graph --xml --report=all -Wall -Werror foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:160" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:160: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:160" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.gv foo.output foo.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:160" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_109 #AT_START_110 at_fn_group_banner 110 'output.at:167' \ "Output files: useless=--header --graph --xml --report=all -Wall -Werror" "" 4 at_xfail=no ( printf "%s\n" "110. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.y foo.gv foo.output foo.xml; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.y <<'_ATEOF' %define useless %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.y >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:167: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.y || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.y || exit 77" "output.at:167" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:167" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:167: rm -f foo.y.bak" at_fn_check_prepare_trace "output.at:167" ( $at_check_trace; rm -f foo.y.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:167" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/output.at:167: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header --graph --xml --report=all -Wall -Werror foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header --graph --xml --report=all -Wall -Werror foo.y" "output.at:167" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --header --graph --xml --report=all -Wall -Werror foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:167" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:167: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.y|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:167" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.y|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.gv foo.output foo.xml " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:167" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_110 #AT_START_111 at_fn_group_banner 111 'output.at:173' \ "Output files: %defines -o foo.c++" " " 4 at_xfail=no ( printf "%s\n" "111. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c++ foo.h++; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %defines %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:173: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:173" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:173: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:173" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:173: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o foo.c++ foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:173" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:173: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" "output.at:173" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:173: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:173" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:173: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:173" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:173: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:173" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:173: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ foo.yy" at_fn_check_prepare_trace "output.at:173" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:173: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:173" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c++ foo.h++ " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:173" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_111 #AT_START_112 at_fn_group_banner 112 'output.at:176' \ "Output files: %defines \"foo.hpp\" -o foo.c++" " " 4 at_xfail=no ( printf "%s\n" "112. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.c++ foo.hpp; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %defines "foo.hpp" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:176: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:176" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:176: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:176" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:176: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o foo.c++ foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:176" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:176: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy" "output.at:176" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:176: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:176" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:176: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:176" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:176: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:176" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:176: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ foo.yy" at_fn_check_prepare_trace "output.at:176" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o foo.c++ foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:176: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:176" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.c++ foo.hpp " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:176" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_112 #AT_START_113 at_fn_group_banner 113 'output.at:191' \ "Output files: lalr1.cc " " " 4 at_xfail=no ( printf "%s\n" "113. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.tab.cc; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:191: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:191" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:191: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:191" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:191: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:191" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:191: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:191" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.tab.cc " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:191" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_113 #AT_START_114 at_fn_group_banner 114 'output.at:194' \ "Output files: lalr1.cc %verbose " " " 4 at_xfail=no ( printf "%s\n" "114. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.output foo.tab.cc; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:194: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:194" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:194: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:194" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:194: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:194" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:194: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:194" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:194: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:194" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:194: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:194" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.cc " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:194" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_114 #AT_START_115 at_fn_group_banner 115 'output.at:197' \ "Output files: lalr1.cc %header %verbose " " " 4 at_xfail=no ( printf "%s\n" "115. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.output foo.tab.cc foo.tab.hh stack.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:197: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:197" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:197: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:197" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:197: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:197" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:197: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:197" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:197: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:197" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:197: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:197" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:197: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:197" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:197: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:197" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:197: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:197" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.cc foo.tab.hh stack.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:197" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_115 #AT_START_116 at_fn_group_banner 116 'output.at:200' \ "Output files: lalr1.cc %verbose %locations " " " 4 at_xfail=no ( printf "%s\n" "116. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.output foo.tab.cc; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %verbose %locations %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:200: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:200" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:200: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:200" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:200: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:200" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:200: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:200" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:200: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:200" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:200: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:200" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:200: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:200" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:200: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:200" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:200: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:200" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.cc " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:200" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_116 #AT_START_117 at_fn_group_banner 117 'output.at:203' \ "Output files: lalr1.cc %header %verbose %locations " "" 4 at_xfail=no ( printf "%s\n" "117. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.output foo.tab.cc foo.tab.hh location.hh position.hh stack.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %verbose %locations %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:203: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:203" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:203: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:203" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:203: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:203" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:203: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:203" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:203: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:203" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:203: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:203" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:203: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:203" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:203: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:203" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:203: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:203" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.cc foo.tab.hh location.hh position.hh stack.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:203" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_117 #AT_START_118 at_fn_group_banner 118 'output.at:206' \ "Output files: lalr1.cc %header %verbose " " " 4 at_xfail=no ( printf "%s\n" "118. $at_setup_line: testing $at_desc ..." $at_traceon for file in subdir/foo.yy foo.output foo.tab.cc foo.tab.hh stack.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >subdir/foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %verbose %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' subdir/foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:206: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" subdir/foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" subdir/foo.yy || exit 77" "output.at:206" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" subdir/foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:206: rm -f subdir/foo.yy.bak" at_fn_check_prepare_trace "output.at:206" ( $at_check_trace; rm -f subdir/foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:206: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv subdir/foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:206" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv subdir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:206: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml subdir/foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml subdir/foo.yy" "output.at:206" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml subdir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:206: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:206" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:206: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:206" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:206: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:206" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:206: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret subdir/foo.yy" at_fn_check_prepare_trace "output.at:206" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret subdir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:206: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(subdir/foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:206" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(subdir/foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.output foo.tab.cc foo.tab.hh stack.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } # Also make sure that the includes do not refer to the subdirectory. { set +x printf "%s\n" "$at_srcdir/output.at:206: grep 'include .subdir/' foo.tab.cc" at_fn_check_prepare_trace "output.at:206" ( $at_check_trace; grep 'include .subdir/' foo.tab.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:206: grep 'include .subdir/' foo.tab.hh" at_fn_check_prepare_trace "output.at:206" ( $at_check_trace; grep 'include .subdir/' foo.tab.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:206" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_118 #AT_START_119 at_fn_group_banner 119 'output.at:210' \ "Output files: lalr1.cc %header %verbose %locations -o subdir/foo.cc" "" 4 at_xfail=no ( printf "%s\n" "119. $at_setup_line: testing $at_desc ..." $at_traceon for file in subdir/foo.yy subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/position.hh subdir/stack.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >subdir/foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %verbose %locations %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' subdir/foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:210: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" subdir/foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" subdir/foo.yy || exit 77" "output.at:210" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" subdir/foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:210: rm -f subdir/foo.yy.bak" at_fn_check_prepare_trace "output.at:210" ( $at_check_trace; rm -f subdir/foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:210: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o subdir/foo.cc subdir/foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:210" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o subdir/foo.cc subdir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:210: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o subdir/foo.cc subdir/foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o subdir/foo.cc subdir/foo.yy" "output.at:210" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o subdir/foo.cc subdir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:210: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:210" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:210: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:210" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:210: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:210" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:210: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o subdir/foo.cc subdir/foo.yy" at_fn_check_prepare_trace "output.at:210" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o subdir/foo.cc subdir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:210: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(subdir/foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:210" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(subdir/foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/position.hh subdir/stack.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } # Also make sure that the includes do not refer to the subdirectory. { set +x printf "%s\n" "$at_srcdir/output.at:210: grep 'include .subdir/' subdir/foo.cc" at_fn_check_prepare_trace "output.at:210" ( $at_check_trace; grep 'include .subdir/' subdir/foo.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:210: grep 'include .subdir/' subdir/foo.hh" at_fn_check_prepare_trace "output.at:210" ( $at_check_trace; grep 'include .subdir/' subdir/foo.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:210" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_119 #AT_START_120 at_fn_group_banner 120 'output.at:215' \ "Output files: lalr1.cc %header %verbose %file-prefix \"output_dir/foo\" " "" 4 at_xfail=no ( printf "%s\n" "120. $at_setup_line: testing $at_desc ..." $at_traceon for file in gram_dir/foo.yy output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/stack.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >gram_dir/foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %verbose %file-prefix "output_dir/foo" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' gram_dir/foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:215: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" gram_dir/foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" gram_dir/foo.yy || exit 77" "output.at:215" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" gram_dir/foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:215: rm -f gram_dir/foo.yy.bak" at_fn_check_prepare_trace "output.at:215" ( $at_check_trace; rm -f gram_dir/foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:215: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv gram_dir/foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:215" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv gram_dir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:215: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml gram_dir/foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml gram_dir/foo.yy" "output.at:215" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml gram_dir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:215: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:215" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:215: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:215" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:215: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:215" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:215: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret gram_dir/foo.yy" at_fn_check_prepare_trace "output.at:215" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret gram_dir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:215: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(gram_dir/foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:215" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(gram_dir/foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/stack.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:215" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_120 #AT_START_121 at_fn_group_banner 121 'output.at:220' \ "Output files: lalr1.cc %header %locations %verbose %file-prefix \"output_dir/foo\" " "" 4 at_xfail=no ( printf "%s\n" "121. $at_setup_line: testing $at_desc ..." $at_traceon for file in gram_dir/foo.yy output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >gram_dir/foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %locations %verbose %file-prefix "output_dir/foo" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' gram_dir/foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:220: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" gram_dir/foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" gram_dir/foo.yy || exit 77" "output.at:220" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" gram_dir/foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:220: rm -f gram_dir/foo.yy.bak" at_fn_check_prepare_trace "output.at:220" ( $at_check_trace; rm -f gram_dir/foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv gram_dir/foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv gram_dir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml gram_dir/foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml gram_dir/foo.yy" "output.at:220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml gram_dir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:220: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:220" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:220: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:220" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:220: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:220" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret gram_dir/foo.yy" at_fn_check_prepare_trace "output.at:220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret gram_dir/foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:220: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(gram_dir/foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:220" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(gram_dir/foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:220" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_121 #AT_START_122 at_fn_group_banner 122 'output.at:226' \ "Output files: lalr1.cc %header %locations api.location.file=none %require \"3.2\" " "" 4 at_xfail=no ( printf "%s\n" "122. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.tab.cc foo.tab.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %locations %define api.location.file none %require "3.2" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:226: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:226" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:226: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:226" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:226: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:226" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:226: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:226" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:226: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:226" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:226: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:226" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:226: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:226" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:226: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:226" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:226: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:226" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.tab.cc foo.tab.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:226" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_122 #AT_START_123 at_fn_group_banner 123 'output.at:231' \ "Output files: lalr1.cc %header %locations api.location.file=\"foo.loc.hh\" %require \"3.2\" " "" 4 at_xfail=no ( printf "%s\n" "123. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.loc.hh foo.tab.cc foo.tab.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %locations %define api.location.file "foo.loc.hh" %require "3.2" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:231: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:231" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:231: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:231" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:231: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:231" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:231: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:231" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:231: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:231" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:231: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:231" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:231: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:231" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:231: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:231" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:231: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:231" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.loc.hh foo.tab.cc foo.tab.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:231" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_123 #AT_START_124 at_fn_group_banner 124 'output.at:237' \ "Output files: lalr1.cc %header %locations api.location.file=\"\$at_dir/foo.loc.hh\" %require \"3.2\" " "" 4 at_xfail=no ( printf "%s\n" "124. $at_setup_line: testing $at_desc ..." $at_traceon for file in foo.yy foo.loc.hh foo.tab.cc foo.tab.hh; do case $file in */*) mkdir -p `echo "$file" | sed 's,/[^/]*,,'`;; esac done cat >foo.yy <<'_ATEOF' %skeleton "lalr1.cc" %header %locations %define api.location.file "$at_dir/foo.loc.hh" %require "3.2" %% foo: '0' {}; _ATEOF # There is no AT_DATA_UNQUOTED. if $EGREP 'at_dir' foo.yy >/dev/null; then { set +x printf "%s\n" "$at_srcdir/output.at:237: \"\$PERL\" -pi -e 's{\\\$at_dir}'\"{\$at_group_dir}g\" foo.yy || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -pi -e 's{\\$at_dir}'\"{$at_group_dir}g\" foo.yy || exit 77" "output.at:237" ( $at_check_trace; "$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" foo.yy || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } # On Cygwin, up to Perl 5.28, 'perl -pi' left a foo.bak file. { set +x printf "%s\n" "$at_srcdir/output.at:237: rm -f foo.yy.bak" at_fn_check_prepare_trace "output.at:237" ( $at_check_trace; rm -f foo.yy.bak ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:237: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv foo.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:237" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:237: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy" "output.at:237" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:237: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:237" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:237: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:237" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:237: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:237" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:237: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy" at_fn_check_prepare_trace "output.at:237" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret foo.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } # Ignore the files non-generated files { set +x printf "%s\n" "$at_srcdir/output.at:237: find . -type f | \"\$PERL\" -ne ' s,\\./,,; chomp; push @file, \$_ unless m{^(foo.yy|testsuite.log)\$}; END { print join (\" \", sort @file), \"\\n\" }' || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "output.at:237" ( $at_check_trace; find . -type f | "$PERL" -ne ' s,\./,,; chomp; push @file, $_ unless m{^(foo.yy|testsuite.log)$}; END { print join (" ", sort @file), "\n" }' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "foo.loc.hh foo.tab.cc foo.tab.hh " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:237" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_124 #AT_START_125 at_fn_group_banner 125 'output.at:267' \ "Conflicting output files: --graph=\"foo.tab.c\"" " " 4 at_xfail=no ( printf "%s\n" "125. $at_setup_line: testing $at_desc ..." $at_traceon case "foo.y" in */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; esac cat >foo.y <<'_ATEOF' %% foo: {}; _ATEOF cp foo.y expout # Because an output file name conflict is still a warning, Bison exits # with status 0, so AT_BISON_CHECK does not realize that there may be no # output file against which to check the XML. AT_BISON_CHECK_NO_XML # avoids that problem. { set +x printf "%s\n" "$at_srcdir/output.at:267: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y" at_fn_check_prepare_trace "output.at:267" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --graph="foo.tab.c" foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "foo.y: warning: conflicting outputs to file 'foo.tab.c' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/output.at:267: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y -Werror" "output.at:267" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="foo.tab.c" foo.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' foo.y: warning: conflicting outputs to file 'foo.tab.c' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/output.at:267: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "output.at:267" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/output.at:267: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y --warnings=error" "output.at:267" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="foo.tab.c" foo.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/output.at:267: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y -Wnone,none -Werror --trace=none" "output.at:267" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="foo.tab.c" foo.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:267: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"foo.tab.c\" foo.y --warnings=none -Werror --trace=none" "output.at:267" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="foo.tab.c" foo.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:267: cat foo.y" at_fn_check_prepare_trace "output.at:267" ( $at_check_trace; cat foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:267" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_125 #AT_START_126 at_fn_group_banner 126 'output.at:272' \ "Conflicting output files: %header \"foo.output\" -v" "" 4 at_xfail=no ( printf "%s\n" "126. $at_setup_line: testing $at_desc ..." $at_traceon case "foo.y" in */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; esac cat >foo.y <<'_ATEOF' %header "foo.output" %% foo: {}; _ATEOF cp foo.y expout # Because an output file name conflict is still a warning, Bison exits # with status 0, so AT_BISON_CHECK does not realize that there may be no # output file against which to check the XML. AT_BISON_CHECK_NO_XML # avoids that problem. { set +x printf "%s\n" "$at_srcdir/output.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v foo.y" at_fn_check_prepare_trace "output.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "foo.y: warning: conflicting outputs to file 'foo.output' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/output.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y -Werror" "output.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' foo.y: warning: conflicting outputs to file 'foo.output' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/output.at:272: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "output.at:272" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/output.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y --warnings=error" "output.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/output.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y -Wnone,none -Werror --trace=none" "output.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y --warnings=none -Werror --trace=none" "output.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v foo.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:272: cat foo.y" at_fn_check_prepare_trace "output.at:272" ( $at_check_trace; cat foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:272" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_126 #AT_START_127 at_fn_group_banner 127 'output.at:277' \ "Conflicting output files: lalr1.cc %header %locations --graph=\"location.hh\"" "" 4 at_xfail=no ( printf "%s\n" "127. $at_setup_line: testing $at_desc ..." $at_traceon case "foo.y" in */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; esac cat >foo.y <<'_ATEOF' %skeleton "lalr1.cc" %header %locations %% foo: {}; _ATEOF cp foo.y expout # Because an output file name conflict is still a warning, Bison exits # with status 0, so AT_BISON_CHECK does not realize that there may be no # output file against which to check the XML. AT_BISON_CHECK_NO_XML # avoids that problem. { set +x printf "%s\n" "$at_srcdir/output.at:277: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y" at_fn_check_prepare_trace "output.at:277" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --graph="location.hh" foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "foo.y: warning: conflicting outputs to file 'location.hh' [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/output.at:277: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y -Werror" "output.at:277" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="location.hh" foo.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' foo.y: warning: conflicting outputs to file 'location.hh' [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/output.at:277: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "output.at:277" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/output.at:277: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y --warnings=error" "output.at:277" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="location.hh" foo.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/output.at:277: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y -Wnone,none -Werror --trace=none" "output.at:277" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="location.hh" foo.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:277: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph=\"location.hh\" foo.y --warnings=none -Werror --trace=none" "output.at:277" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --graph="location.hh" foo.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:277: cat foo.y" at_fn_check_prepare_trace "output.at:277" ( $at_check_trace; cat foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:277" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_127 #AT_START_128 at_fn_group_banner 128 'output.at:282' \ "Conflicting output files: -o foo.y" " " 4 at_xfail=no ( printf "%s\n" "128. $at_setup_line: testing $at_desc ..." $at_traceon case "foo.y" in */*) mkdir `echo "foo.y" | sed 's,/.*,,'`;; esac cat >foo.y <<'_ATEOF' %% foo: {}; _ATEOF cp foo.y expout # Because an output file name conflict is still a warning, Bison exits # with status 0, so AT_BISON_CHECK does not realize that there may be no # output file against which to check the XML. AT_BISON_CHECK_NO_XML # avoids that problem. { set +x printf "%s\n" "$at_srcdir/output.at:282: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o foo.y foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o foo.y foo.y" "output.at:282" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o foo.y foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "foo.y: error: refusing to overwrite the input file 'foo.y' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/output.at:282" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:282: cat foo.y" at_fn_check_prepare_trace "output.at:282" ( $at_check_trace; cat foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:282" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_128 #AT_START_129 at_fn_group_banner 129 'output.at:328' \ "Output file name: \`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'" "" 4 at_xfail=no ( printf "%s\n" "129. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:328: touch \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.tmp\" || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; touch "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --header=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" glr.y" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --header="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --header=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" glr.y" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --header="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:328: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:328: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:328" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:328: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" --header=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\" glr.y" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" --header="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:328: ls \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.h\"" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; ls "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:328" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:328" { set +x printf "%s\n" "$at_srcdir/output.at:328: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.c\" " at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.cc\" --header=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.hh\" cxx.y" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.cc" --header="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.cc\" --header=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.hh\" cxx.y" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.cc" --header="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:328: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:328: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:328" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:328: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.cc\" --header=\"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.hh\" cxx.y" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.cc" --header="\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:328: ls \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.cc\" \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.hh\"" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; ls "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.cc" "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:328" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:328" { set +x printf "%s\n" "$at_srcdir/output.at:328: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"\\\`~!@#\\\$%^&*()-=_+{}[]|\\\\:;<>, .'.cc\" " at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:328" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "\`~!@#\$%^&*()-=_+{}[]|\\:;<>, .'.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:328" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_129 #AT_START_130 at_fn_group_banner 130 'output.at:335' \ "Output file name: (" " " 4 at_xfail=no ( printf "%s\n" "130. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:335: touch \"(.tmp\" || exit 77" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; touch "(.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:335: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"(.c\" --header=\"(.h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:335" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "(.c" --header="(.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:335: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"(.c\" --header=\"(.h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"(.c\" --header=\"(.h\" glr.y" "output.at:335" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "(.c" --header="(.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:335: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:335" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:335: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:335: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:335" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:335: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"(.c\" --header=\"(.h\" glr.y" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "(.c" --header="(.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:335: ls \"(.c\" \"(.h\"" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; ls "(.c" "(.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:335" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:335" { set +x printf "%s\n" "$at_srcdir/output.at:335: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"(.c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"(.c\" " "output.at:335" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "(.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:335: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"(.cc\" --header=\"(.hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:335" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "(.cc" --header="(.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:335: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"(.cc\" --header=\"(.hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"(.cc\" --header=\"(.hh\" cxx.y" "output.at:335" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "(.cc" --header="(.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:335: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:335" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:335: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:335: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:335" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:335: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"(.cc\" --header=\"(.hh\" cxx.y" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "(.cc" --header="(.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:335: ls \"(.cc\" \"(.hh\"" at_fn_check_prepare_trace "output.at:335" ( $at_check_trace; ls "(.cc" "(.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:335" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:335" { set +x printf "%s\n" "$at_srcdir/output.at:335: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"(.cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"(.cc\" " "output.at:335" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "(.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:335" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_130 #AT_START_131 at_fn_group_banner 131 'output.at:336' \ "Output file name: )" " " 4 at_xfail=no ( printf "%s\n" "131. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:336: touch \").tmp\" || exit 77" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; touch ").tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \").c\" --header=\").h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o ").c" --header=").h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \").c\" --header=\").h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \").c\" --header=\").h\" glr.y" "output.at:336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o ").c" --header=").h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:336: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:336" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:336: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:336: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:336" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \").c\" --header=\").h\" glr.y" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o ").c" --header=").h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:336: ls \").c\" \").h\"" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; ls ").c" ").h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:336" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:336" { set +x printf "%s\n" "$at_srcdir/output.at:336: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \").c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \").c\" " "output.at:336" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c ").c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \").cc\" --header=\").hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o ").cc" --header=").hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \").cc\" --header=\").hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \").cc\" --header=\").hh\" cxx.y" "output.at:336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o ").cc" --header=").hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:336: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:336" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:336: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:336: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:336" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \").cc\" --header=\").hh\" cxx.y" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o ").cc" --header=").hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:336: ls \").cc\" \").hh\"" at_fn_check_prepare_trace "output.at:336" ( $at_check_trace; ls ").cc" ").hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:336" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:336" { set +x printf "%s\n" "$at_srcdir/output.at:336: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \").cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \").cc\" " "output.at:336" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c ").cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:336" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_131 #AT_START_132 at_fn_group_banner 132 'output.at:337' \ "Output file name: #" " " 4 at_xfail=no ( printf "%s\n" "132. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:337: touch \"#.tmp\" || exit 77" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; touch "#.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"#.c\" --header=\"#.h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "#.c" --header="#.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"#.c\" --header=\"#.h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"#.c\" --header=\"#.h\" glr.y" "output.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "#.c" --header="#.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:337: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"#.c\" --header=\"#.h\" glr.y" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "#.c" --header="#.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:337: ls \"#.c\" \"#.h\"" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; ls "#.c" "#.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:337" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:337" { set +x printf "%s\n" "$at_srcdir/output.at:337: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"#.c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"#.c\" " "output.at:337" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "#.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"#.cc\" --header=\"#.hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "#.cc" --header="#.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"#.cc\" --header=\"#.hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"#.cc\" --header=\"#.hh\" cxx.y" "output.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "#.cc" --header="#.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:337: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"#.cc\" --header=\"#.hh\" cxx.y" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "#.cc" --header="#.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:337: ls \"#.cc\" \"#.hh\"" at_fn_check_prepare_trace "output.at:337" ( $at_check_trace; ls "#.cc" "#.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:337" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:337" { set +x printf "%s\n" "$at_srcdir/output.at:337: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"#.cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"#.cc\" " "output.at:337" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "#.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:337" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_132 #AT_START_133 at_fn_group_banner 133 'output.at:338' \ "Output file name: @@" " " 4 at_xfail=no ( printf "%s\n" "133. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:338: touch \"@@.tmp\" || exit 77" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; touch "@@.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"@@.c\" --header=\"@@.h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "@@.c" --header="@@.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@@.c\" --header=\"@@.h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@@.c\" --header=\"@@.h\" glr.y" "output.at:338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "@@.c" --header="@@.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:338: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:338" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:338: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:338: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:338" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"@@.c\" --header=\"@@.h\" glr.y" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "@@.c" --header="@@.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:338: ls \"@@.c\" \"@@.h\"" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; ls "@@.c" "@@.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:338" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:338" { set +x printf "%s\n" "$at_srcdir/output.at:338: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"@@.c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"@@.c\" " "output.at:338" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "@@.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"@@.cc\" --header=\"@@.hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "@@.cc" --header="@@.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@@.cc\" --header=\"@@.hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@@.cc\" --header=\"@@.hh\" cxx.y" "output.at:338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "@@.cc" --header="@@.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:338: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:338" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:338: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:338: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:338" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"@@.cc\" --header=\"@@.hh\" cxx.y" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "@@.cc" --header="@@.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:338: ls \"@@.cc\" \"@@.hh\"" at_fn_check_prepare_trace "output.at:338" ( $at_check_trace; ls "@@.cc" "@@.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:338" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:338" { set +x printf "%s\n" "$at_srcdir/output.at:338: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"@@.cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"@@.cc\" " "output.at:338" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "@@.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:338" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_133 #AT_START_134 at_fn_group_banner 134 'output.at:339' \ "Output file name: @{" " " 4 at_xfail=no ( printf "%s\n" "134. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:339: touch \"@{.tmp\" || exit 77" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; touch "@{.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:339: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"@{.c\" --header=\"@{.h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:339" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "@{.c" --header="@{.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:339: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@{.c\" --header=\"@{.h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@{.c\" --header=\"@{.h\" glr.y" "output.at:339" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "@{.c" --header="@{.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:339: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:339" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:339: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:339: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:339" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:339: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"@{.c\" --header=\"@{.h\" glr.y" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "@{.c" --header="@{.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:339: ls \"@{.c\" \"@{.h\"" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; ls "@{.c" "@{.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:339" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:339" { set +x printf "%s\n" "$at_srcdir/output.at:339: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"@{.c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"@{.c\" " "output.at:339" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "@{.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:339: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"@{.cc\" --header=\"@{.hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:339" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "@{.cc" --header="@{.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:339: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@{.cc\" --header=\"@{.hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@{.cc\" --header=\"@{.hh\" cxx.y" "output.at:339" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "@{.cc" --header="@{.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:339: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:339" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:339: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:339: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:339" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:339: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"@{.cc\" --header=\"@{.hh\" cxx.y" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "@{.cc" --header="@{.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:339: ls \"@{.cc\" \"@{.hh\"" at_fn_check_prepare_trace "output.at:339" ( $at_check_trace; ls "@{.cc" "@{.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:339" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:339" { set +x printf "%s\n" "$at_srcdir/output.at:339: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"@{.cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"@{.cc\" " "output.at:339" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "@{.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:339" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_134 #AT_START_135 at_fn_group_banner 135 'output.at:340' \ "Output file name: @}" " " 4 at_xfail=no ( printf "%s\n" "135. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:340: touch \"@}.tmp\" || exit 77" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; touch "@}.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"@}.c\" --header=\"@}.h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "@}.c" --header="@}.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@}.c\" --header=\"@}.h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@}.c\" --header=\"@}.h\" glr.y" "output.at:340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "@}.c" --header="@}.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:340: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:340" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:340: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:340: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:340" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"@}.c\" --header=\"@}.h\" glr.y" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "@}.c" --header="@}.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:340: ls \"@}.c\" \"@}.h\"" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; ls "@}.c" "@}.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:340" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:340" { set +x printf "%s\n" "$at_srcdir/output.at:340: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"@}.c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"@}.c\" " "output.at:340" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "@}.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"@}.cc\" --header=\"@}.hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "@}.cc" --header="@}.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@}.cc\" --header=\"@}.hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"@}.cc\" --header=\"@}.hh\" cxx.y" "output.at:340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "@}.cc" --header="@}.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:340: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:340" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:340: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:340: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:340" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"@}.cc\" --header=\"@}.hh\" cxx.y" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "@}.cc" --header="@}.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:340: ls \"@}.cc\" \"@}.hh\"" at_fn_check_prepare_trace "output.at:340" ( $at_check_trace; ls "@}.cc" "@}.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:340" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:340" { set +x printf "%s\n" "$at_srcdir/output.at:340: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"@}.cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"@}.cc\" " "output.at:340" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "@}.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:340" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_135 #AT_START_136 at_fn_group_banner 136 'output.at:341' \ "Output file name: [" " " 4 at_xfail=no ( printf "%s\n" "136. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:341: touch \"[.tmp\" || exit 77" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; touch "[.tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"[.c\" --header=\"[.h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "[.c" --header="[.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"[.c\" --header=\"[.h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"[.c\" --header=\"[.h\" glr.y" "output.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "[.c" --header="[.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:341: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"[.c\" --header=\"[.h\" glr.y" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "[.c" --header="[.h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:341: ls \"[.c\" \"[.h\"" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; ls "[.c" "[.h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:341" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:341" { set +x printf "%s\n" "$at_srcdir/output.at:341: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"[.c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"[.c\" " "output.at:341" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "[.c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"[.cc\" --header=\"[.hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "[.cc" --header="[.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"[.cc\" --header=\"[.hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"[.cc\" --header=\"[.hh\" cxx.y" "output.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "[.cc" --header="[.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:341: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"[.cc\" --header=\"[.hh\" cxx.y" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "[.cc" --header="[.hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:341: ls \"[.cc\" \"[.hh\"" at_fn_check_prepare_trace "output.at:341" ( $at_check_trace; ls "[.cc" "[.hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:341" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:341" { set +x printf "%s\n" "$at_srcdir/output.at:341: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"[.cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"[.cc\" " "output.at:341" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "[.cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:341" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_136 #AT_START_137 at_fn_group_banner 137 'output.at:342' \ "Output file name: ]" " " 4 at_xfail=no ( printf "%s\n" "137. $at_setup_line: testing $at_desc ..." $at_traceon # Skip if platform doesn't support file name. For example, Cygwin # doesn't support file names containing ":" or "\". { set +x printf "%s\n" "$at_srcdir/output.at:342: touch \"].tmp\" || exit 77" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; touch "].tmp" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } cat >glr.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %code { void yyerror (const char *msg); int yylex (void); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"].c\" --header=\"].h\" glr.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "].c" --header="].h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"].c\" --header=\"].h\" glr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"].c\" --header=\"].h\" glr.y" "output.at:342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "].c" --header="].h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:342: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:342" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:342: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:342: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:342" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"].c\" --header=\"].h\" glr.y" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "].c" --header="].h" glr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:342: ls \"].c\" \"].h\"" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; ls "].c" "].h" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:342" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:342" { set +x printf "%s\n" "$at_srcdir/output.at:342: \$CC \$CFLAGS \$CPPFLAGS -c -o glr.o -c \"].c\" " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o glr.o -c \"].c\" " "output.at:342" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o glr.o -c "].c" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } cat >cxx.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { int yylex (yy::parser::semantic_type*); } %% start: {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \"].cc\" --header=\"].hh\" cxx.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o "].cc" --header="].hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"].cc\" --header=\"].hh\" cxx.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"].cc\" --header=\"].hh\" cxx.y" "output.at:342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o "].cc" --header="].hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:342: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:342" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:342: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:342: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:342" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"].cc\" --header=\"].hh\" cxx.y" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o "].cc" --header="].hh" cxx.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:342: ls \"].cc\" \"].hh\"" at_fn_check_prepare_trace "output.at:342" ( $at_check_trace; ls "].cc" "].hh" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:342" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:342" { set +x printf "%s\n" "$at_srcdir/output.at:342: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx.o -c \"].cc\" " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c \"].cc\" " "output.at:342" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx.o -c "].cc" ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:342" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_137 #AT_START_138 at_fn_group_banner 138 'output.at:363' \ "Graph with no conflicts" " " 4 at_xfail=no ( printf "%s\n" "138. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: a '?' b; a: ; b: 'b'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall --graph input.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" "output.at:363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:363: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:363" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y" at_fn_check_prepare_trace "output.at:363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:363: grep -v // input.gv" at_fn_check_prepare_trace "output.at:363" ( $at_check_trace; grep -v // input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • exp \$end\\l 1 exp: • a '?' b\\l 2 a: • %empty\\l\"] 0 -> 1 [style=dashed label=\"exp\"] 0 -> 2 [style=dashed label=\"a\"] 0 -> \"0R2\" [style=solid] \"0R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 1 [label=\"State 1\\n\\l 0 \$accept: exp • \$end\\l\"] 1 -> 3 [style=solid label=\"\$end\"] 2 [label=\"State 2\\n\\l 1 exp: a • '?' b\\l\"] 2 -> 4 [style=solid label=\"'?'\"] 3 [label=\"State 3\\n\\l 0 \$accept: exp \$end •\\l\"] 3 -> \"3R0\" [style=solid] \"3R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 4 [label=\"State 4\\n\\l 1 exp: a '?' • b\\l 3 b: • 'b'\\l\"] 4 -> 5 [style=solid label=\"'b'\"] 4 -> 6 [style=dashed label=\"b\"] 5 [label=\"State 5\\n\\l 3 b: 'b' •\\l\"] 5 -> \"5R3\" [style=solid] \"5R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 6 [label=\"State 6\\n\\l 1 exp: a '?' b •\\l\"] 6 -> \"6R1\" [style=solid] \"6R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:363" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_138 #AT_START_139 at_fn_group_banner 139 'output.at:403' \ "Graph with unsolved S/R" " " 4 at_xfail=no ( printf "%s\n" "139. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% start: 'a' | empty_a 'a' | 'b' | empty_b 'b' | 'c' | empty_c 'c' ; empty_a: %prec 'a'; empty_b: %prec 'b'; empty_c: %prec 'c'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:403: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall --graph input.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:403" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:403: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" "output.at:403" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:403: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:403" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:403: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:403" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:403: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:403" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:403: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y" at_fn_check_prepare_trace "output.at:403" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:403: grep -v // input.gv" at_fn_check_prepare_trace "output.at:403" ( $at_check_trace; grep -v // input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • start \$end\\l 1 start: • 'a'\\l 2 | • empty_a 'a'\\l 3 | • 'b'\\l 4 | • empty_b 'b'\\l 5 | • 'c'\\l 6 | • empty_c 'c'\\l 7 empty_a: • %empty ['a']\\l 8 empty_b: • %empty ['b']\\l 9 empty_c: • %empty ['c']\\l\"] 0 -> 1 [style=solid label=\"'a'\"] 0 -> 2 [style=solid label=\"'b'\"] 0 -> 3 [style=solid label=\"'c'\"] 0 -> 4 [style=dashed label=\"start\"] 0 -> 5 [style=dashed label=\"empty_a\"] 0 -> 6 [style=dashed label=\"empty_b\"] 0 -> 7 [style=dashed label=\"empty_c\"] 0 -> \"0R7d\" [label=\"['a']\", style=solid] \"0R7d\" [label=\"R7\", fillcolor=5, shape=diamond, style=filled] 0 -> \"0R8d\" [label=\"['b']\", style=solid] \"0R8d\" [label=\"R8\", fillcolor=5, shape=diamond, style=filled] 0 -> \"0R9d\" [label=\"['c']\", style=solid] \"0R9d\" [label=\"R9\", fillcolor=5, shape=diamond, style=filled] 1 [label=\"State 1\\n\\l 1 start: 'a' •\\l\"] 1 -> \"1R1\" [style=solid] \"1R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] 2 [label=\"State 2\\n\\l 3 start: 'b' •\\l\"] 2 -> \"2R3\" [style=solid] \"2R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 3 [label=\"State 3\\n\\l 5 start: 'c' •\\l\"] 3 -> \"3R5\" [style=solid] \"3R5\" [label=\"R5\", fillcolor=3, shape=diamond, style=filled] 4 [label=\"State 4\\n\\l 0 \$accept: start • \$end\\l\"] 4 -> 8 [style=solid label=\"\$end\"] 5 [label=\"State 5\\n\\l 2 start: empty_a • 'a'\\l\"] 5 -> 9 [style=solid label=\"'a'\"] 6 [label=\"State 6\\n\\l 4 start: empty_b • 'b'\\l\"] 6 -> 10 [style=solid label=\"'b'\"] 7 [label=\"State 7\\n\\l 6 start: empty_c • 'c'\\l\"] 7 -> 11 [style=solid label=\"'c'\"] 8 [label=\"State 8\\n\\l 0 \$accept: start \$end •\\l\"] 8 -> \"8R0\" [style=solid] \"8R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 9 [label=\"State 9\\n\\l 2 start: empty_a 'a' •\\l\"] 9 -> \"9R2\" [style=solid] \"9R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 10 [label=\"State 10\\n\\l 4 start: empty_b 'b' •\\l\"] 10 -> \"10R4\" [style=solid] \"10R4\" [label=\"R4\", fillcolor=3, shape=diamond, style=filled] 11 [label=\"State 11\\n\\l 6 start: empty_c 'c' •\\l\"] 11 -> \"11R6\" [style=solid] \"11R6\" [label=\"R6\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:403" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_139 #AT_START_140 at_fn_group_banner 140 'output.at:473' \ "Graph with solved S/R" " " 4 at_xfail=no ( printf "%s\n" "140. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %left 'a' %right 'b' %right 'c' %% start: 'a' | empty_a 'a' | 'b' | empty_b 'b' | 'c' | empty_c 'c' ; empty_a: %prec 'a'; empty_b: %prec 'b'; empty_c: %prec 'c'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:473: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall --graph input.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:473" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:473: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" "output.at:473" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:473: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:473" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:473: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:473" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:473: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:473" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:473: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y" at_fn_check_prepare_trace "output.at:473" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:473: grep -v // input.gv" at_fn_check_prepare_trace "output.at:473" ( $at_check_trace; grep -v // input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • start \$end\\l 1 start: • 'a'\\l 2 | • empty_a 'a'\\l 3 | • 'b'\\l 4 | • empty_b 'b'\\l 5 | • 'c'\\l 6 | • empty_c 'c'\\l 7 empty_a: • %empty ['a']\\l 8 empty_b: • %empty []\\l 9 empty_c: • %empty []\\l\"] 0 -> 1 [style=solid label=\"'b'\"] 0 -> 2 [style=solid label=\"'c'\"] 0 -> 3 [style=dashed label=\"start\"] 0 -> 4 [style=dashed label=\"empty_a\"] 0 -> 5 [style=dashed label=\"empty_b\"] 0 -> 6 [style=dashed label=\"empty_c\"] 0 -> \"0R7\" [style=solid] \"0R7\" [label=\"R7\", fillcolor=3, shape=diamond, style=filled] 1 [label=\"State 1\\n\\l 3 start: 'b' •\\l\"] 1 -> \"1R3\" [style=solid] \"1R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 2 [label=\"State 2\\n\\l 5 start: 'c' •\\l\"] 2 -> \"2R5\" [style=solid] \"2R5\" [label=\"R5\", fillcolor=3, shape=diamond, style=filled] 3 [label=\"State 3\\n\\l 0 \$accept: start • \$end\\l\"] 3 -> 7 [style=solid label=\"\$end\"] 4 [label=\"State 4\\n\\l 2 start: empty_a • 'a'\\l\"] 4 -> 8 [style=solid label=\"'a'\"] 5 [label=\"State 5\\n\\l 4 start: empty_b • 'b'\\l\"] 5 -> 9 [style=solid label=\"'b'\"] 6 [label=\"State 6\\n\\l 6 start: empty_c • 'c'\\l\"] 6 -> 10 [style=solid label=\"'c'\"] 7 [label=\"State 7\\n\\l 0 \$accept: start \$end •\\l\"] 7 -> \"7R0\" [style=solid] \"7R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 8 [label=\"State 8\\n\\l 2 start: empty_a 'a' •\\l\"] 8 -> \"8R2\" [style=solid] \"8R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 9 [label=\"State 9\\n\\l 4 start: empty_b 'b' •\\l\"] 9 -> \"9R4\" [style=solid] \"9R4\" [label=\"R4\", fillcolor=3, shape=diamond, style=filled] 10 [label=\"State 10\\n\\l 6 start: empty_c 'c' •\\l\"] 10 -> \"10R6\" [style=solid] \"10R6\" [label=\"R6\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:473" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_140 #AT_START_141 at_fn_group_banner 141 'output.at:538' \ "Graph with R/R" " " 4 at_xfail=no ( printf "%s\n" "141. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: a | b; a: ; b: ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:538: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall --graph input.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:538" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:538: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" "output.at:538" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:538: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:538" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:538: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:538" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:538: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:538" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:538: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y" at_fn_check_prepare_trace "output.at:538" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:538: grep -v // input.gv" at_fn_check_prepare_trace "output.at:538" ( $at_check_trace; grep -v // input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • exp \$end\\l 1 exp: • a\\l 2 | • b\\l 3 a: • %empty [\$end]\\l 4 b: • %empty [\$end]\\l\"] 0 -> 1 [style=dashed label=\"exp\"] 0 -> 2 [style=dashed label=\"a\"] 0 -> 3 [style=dashed label=\"b\"] 0 -> \"0R3\" [style=solid] \"0R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 0 -> \"0R4d\" [label=\"[\$end]\", style=solid] \"0R4d\" [label=\"R4\", fillcolor=5, shape=diamond, style=filled] 1 [label=\"State 1\\n\\l 0 \$accept: exp • \$end\\l\"] 1 -> 4 [style=solid label=\"\$end\"] 2 [label=\"State 2\\n\\l 1 exp: a •\\l\"] 2 -> \"2R1\" [style=solid] \"2R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] 3 [label=\"State 3\\n\\l 2 exp: b •\\l\"] 3 -> \"3R2\" [style=solid] \"3R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 4 [label=\"State 4\\n\\l 0 \$accept: exp \$end •\\l\"] 4 -> \"4R0\" [style=solid] \"4R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:538" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_141 #AT_START_142 at_fn_group_banner 142 'output.at:576' \ "Graph with reductions with multiple LAT" " " 4 at_xfail=no ( printf "%s\n" "142. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: a ';' | a ';' | a '.' | b '?' | b '!' | c '?' | c ';'; a: ; b: ; c: ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:576: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall --graph input.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:576" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:576: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" "output.at:576" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:576: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:576" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:576: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:576" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:576: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:576" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:576: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y" at_fn_check_prepare_trace "output.at:576" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:576: grep -v // input.gv" at_fn_check_prepare_trace "output.at:576" ( $at_check_trace; grep -v // input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • exp \$end\\l 1 exp: • a ';'\\l 2 | • a ';'\\l 3 | • a '.'\\l 4 | • b '?'\\l 5 | • b '!'\\l 6 | • c '?'\\l 7 | • c ';'\\l 8 a: • %empty [';', '.']\\l 9 b: • %empty ['?', '!']\\l 10 c: • %empty [';', '?']\\l\"] 0 -> 1 [style=dashed label=\"exp\"] 0 -> 2 [style=dashed label=\"a\"] 0 -> 3 [style=dashed label=\"b\"] 0 -> 4 [style=dashed label=\"c\"] 0 -> \"0R8\" [style=solid] \"0R8\" [label=\"R8\", fillcolor=3, shape=diamond, style=filled] 0 -> \"0R9\" [label=\"['?', '!']\", style=solid] \"0R9\" [label=\"R9\", fillcolor=3, shape=diamond, style=filled] 0 -> \"0R10d\" [label=\"[';', '?']\", style=solid] \"0R10d\" [label=\"R10\", fillcolor=5, shape=diamond, style=filled] 1 [label=\"State 1\\n\\l 0 \$accept: exp • \$end\\l\"] 1 -> 5 [style=solid label=\"\$end\"] 2 [label=\"State 2\\n\\l 1 exp: a • ';'\\l 2 | a • ';'\\l 3 | a • '.'\\l\"] 2 -> 6 [style=solid label=\"';'\"] 2 -> 7 [style=solid label=\"'.'\"] 3 [label=\"State 3\\n\\l 4 exp: b • '?'\\l 5 | b • '!'\\l\"] 3 -> 8 [style=solid label=\"'?'\"] 3 -> 9 [style=solid label=\"'!'\"] 4 [label=\"State 4\\n\\l 6 exp: c • '?'\\l 7 | c • ';'\\l\"] 4 -> 10 [style=solid label=\"';'\"] 4 -> 11 [style=solid label=\"'?'\"] 5 [label=\"State 5\\n\\l 0 \$accept: exp \$end •\\l\"] 5 -> \"5R0\" [style=solid] \"5R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 6 [label=\"State 6\\n\\l 1 exp: a ';' • [\$end]\\l 2 | a ';' • [\$end]\\l\"] 6 -> \"6R1\" [style=solid] \"6R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] 6 -> \"6R2d\" [label=\"[\$end]\", style=solid] \"6R2d\" [label=\"R2\", fillcolor=5, shape=diamond, style=filled] 7 [label=\"State 7\\n\\l 3 exp: a '.' •\\l\"] 7 -> \"7R3\" [style=solid] \"7R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 8 [label=\"State 8\\n\\l 4 exp: b '?' •\\l\"] 8 -> \"8R4\" [style=solid] \"8R4\" [label=\"R4\", fillcolor=3, shape=diamond, style=filled] 9 [label=\"State 9\\n\\l 5 exp: b '!' •\\l\"] 9 -> \"9R5\" [style=solid] \"9R5\" [label=\"R5\", fillcolor=3, shape=diamond, style=filled] 10 [label=\"State 10\\n\\l 7 exp: c ';' •\\l\"] 10 -> \"10R7\" [style=solid] \"10R7\" [label=\"R7\", fillcolor=3, shape=diamond, style=filled] 11 [label=\"State 11\\n\\l 6 exp: c '?' •\\l\"] 11 -> \"11R6\" [style=solid] \"11R6\" [label=\"R6\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:576" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_142 #AT_START_143 at_fn_group_banner 143 'output.at:641' \ "Graph with a reduction rule both enabled and disabled" "" 4 at_xfail=no ( printf "%s\n" "143. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: ifexp | opexp | imm; ifexp: "if" exp "then" exp elseexp; elseexp: "else" exp | ; opexp: exp '+' exp; imm: '0'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall --graph input.y" at_fn_check_prepare_notrace 'an embedded newline' "output.at:641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y" "output.at:641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:641: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:641" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:641: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:641" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:641: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:641" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y" at_fn_check_prepare_trace "output.at:641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall --graph input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:641: grep -v // input.gv" at_fn_check_prepare_trace "output.at:641" ( $at_check_trace; grep -v // input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • exp \$end\\l 1 exp: • ifexp\\l 2 | • opexp\\l 3 | • imm\\l 4 ifexp: • \\\"if\\\" exp \\\"then\\\" exp elseexp\\l 7 opexp: • exp '+' exp\\l 8 imm: • '0'\\l\"] 0 -> 1 [style=solid label=\"\\\"if\\\"\"] 0 -> 2 [style=solid label=\"'0'\"] 0 -> 3 [style=dashed label=\"exp\"] 0 -> 4 [style=dashed label=\"ifexp\"] 0 -> 5 [style=dashed label=\"opexp\"] 0 -> 6 [style=dashed label=\"imm\"] 1 [label=\"State 1\\n\\l 1 exp: • ifexp\\l 2 | • opexp\\l 3 | • imm\\l 4 ifexp: • \\\"if\\\" exp \\\"then\\\" exp elseexp\\l 4 | \\\"if\\\" • exp \\\"then\\\" exp elseexp\\l 7 opexp: • exp '+' exp\\l 8 imm: • '0'\\l\"] 1 -> 1 [style=solid label=\"\\\"if\\\"\"] 1 -> 2 [style=solid label=\"'0'\"] 1 -> 7 [style=dashed label=\"exp\"] 1 -> 4 [style=dashed label=\"ifexp\"] 1 -> 5 [style=dashed label=\"opexp\"] 1 -> 6 [style=dashed label=\"imm\"] 2 [label=\"State 2\\n\\l 8 imm: '0' •\\l\"] 2 -> \"2R8\" [style=solid] \"2R8\" [label=\"R8\", fillcolor=3, shape=diamond, style=filled] 3 [label=\"State 3\\n\\l 0 \$accept: exp • \$end\\l 7 opexp: exp • '+' exp\\l\"] 3 -> 8 [style=solid label=\"\$end\"] 3 -> 9 [style=solid label=\"'+'\"] 4 [label=\"State 4\\n\\l 1 exp: ifexp •\\l\"] 4 -> \"4R1\" [style=solid] \"4R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] 5 [label=\"State 5\\n\\l 2 exp: opexp •\\l\"] 5 -> \"5R2\" [style=solid] \"5R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 6 [label=\"State 6\\n\\l 3 exp: imm •\\l\"] 6 -> \"6R3\" [style=solid] \"6R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 7 [label=\"State 7\\n\\l 4 ifexp: \\\"if\\\" exp • \\\"then\\\" exp elseexp\\l 7 opexp: exp • '+' exp\\l\"] 7 -> 10 [style=solid label=\"\\\"then\\\"\"] 7 -> 9 [style=solid label=\"'+'\"] 8 [label=\"State 8\\n\\l 0 \$accept: exp \$end •\\l\"] 8 -> \"8R0\" [style=solid] \"8R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 9 [label=\"State 9\\n\\l 1 exp: • ifexp\\l 2 | • opexp\\l 3 | • imm\\l 4 ifexp: • \\\"if\\\" exp \\\"then\\\" exp elseexp\\l 7 opexp: • exp '+' exp\\l 7 | exp '+' • exp\\l 8 imm: • '0'\\l\"] 9 -> 1 [style=solid label=\"\\\"if\\\"\"] 9 -> 2 [style=solid label=\"'0'\"] 9 -> 11 [style=dashed label=\"exp\"] 9 -> 4 [style=dashed label=\"ifexp\"] 9 -> 5 [style=dashed label=\"opexp\"] 9 -> 6 [style=dashed label=\"imm\"] 10 [label=\"State 10\\n\\l 1 exp: • ifexp\\l 2 | • opexp\\l 3 | • imm\\l 4 ifexp: • \\\"if\\\" exp \\\"then\\\" exp elseexp\\l 4 | \\\"if\\\" exp \\\"then\\\" • exp elseexp\\l 7 opexp: • exp '+' exp\\l 8 imm: • '0'\\l\"] 10 -> 1 [style=solid label=\"\\\"if\\\"\"] 10 -> 2 [style=solid label=\"'0'\"] 10 -> 12 [style=dashed label=\"exp\"] 10 -> 4 [style=dashed label=\"ifexp\"] 10 -> 5 [style=dashed label=\"opexp\"] 10 -> 6 [style=dashed label=\"imm\"] 11 [label=\"State 11\\n\\l 7 opexp: exp • '+' exp\\l 7 | exp '+' exp • [\$end, \\\"then\\\", \\\"else\\\", '+']\\l\"] 11 -> 9 [style=solid label=\"'+'\"] 11 -> \"11R7d\" [label=\"['+']\", style=solid] \"11R7d\" [label=\"R7\", fillcolor=5, shape=diamond, style=filled] 11 -> \"11R7\" [style=solid] \"11R7\" [label=\"R7\", fillcolor=3, shape=diamond, style=filled] 12 [label=\"State 12\\n\\l 4 ifexp: \\\"if\\\" exp \\\"then\\\" exp • elseexp\\l 5 elseexp: • \\\"else\\\" exp\\l 6 | • %empty [\$end, \\\"then\\\", \\\"else\\\", '+']\\l 7 opexp: exp • '+' exp\\l\"] 12 -> 13 [style=solid label=\"\\\"else\\\"\"] 12 -> 9 [style=solid label=\"'+'\"] 12 -> 14 [style=dashed label=\"elseexp\"] 12 -> \"12R6d\" [label=\"[\\\"else\\\", '+']\", style=solid] \"12R6d\" [label=\"R6\", fillcolor=5, shape=diamond, style=filled] 12 -> \"12R6\" [style=solid] \"12R6\" [label=\"R6\", fillcolor=3, shape=diamond, style=filled] 13 [label=\"State 13\\n\\l 1 exp: • ifexp\\l 2 | • opexp\\l 3 | • imm\\l 4 ifexp: • \\\"if\\\" exp \\\"then\\\" exp elseexp\\l 5 elseexp: \\\"else\\\" • exp\\l 7 opexp: • exp '+' exp\\l 8 imm: • '0'\\l\"] 13 -> 1 [style=solid label=\"\\\"if\\\"\"] 13 -> 2 [style=solid label=\"'0'\"] 13 -> 15 [style=dashed label=\"exp\"] 13 -> 4 [style=dashed label=\"ifexp\"] 13 -> 5 [style=dashed label=\"opexp\"] 13 -> 6 [style=dashed label=\"imm\"] 14 [label=\"State 14\\n\\l 4 ifexp: \\\"if\\\" exp \\\"then\\\" exp elseexp •\\l\"] 14 -> \"14R4\" [style=solid] \"14R4\" [label=\"R4\", fillcolor=3, shape=diamond, style=filled] 15 [label=\"State 15\\n\\l 5 elseexp: \\\"else\\\" exp • [\$end, \\\"then\\\", \\\"else\\\", '+']\\l 7 opexp: exp • '+' exp\\l\"] 15 -> 9 [style=solid label=\"'+'\"] 15 -> \"15R5d\" [label=\"['+']\", style=solid] \"15R5d\" [label=\"R5\", fillcolor=5, shape=diamond, style=filled] 15 -> \"15R5\" [style=solid] \"15R5\" [label=\"R5\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:641" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_143 #AT_START_144 at_fn_group_banner 144 'output.at:744' \ "C++ Output File Prefix Mapping" " " 4 at_xfail=no ( printf "%s\n" "144. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST([PREFIX], [DIRECTIVES]) # ------------------------------- mkdir -p out/include/ast cat >x1.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.namespace {x1} %header %locations %define api.location.file "include/ast/loc.hh" %code { static int yylex (x1::parser::value_type *lvalp, x1::parser::location_type *llocp); } %% exp: '0'; %% /* A C++ error reporting function. */ void x1::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (x1::parser::value_type *lvalp, x1::parser::location_type *llocp) { static char const input[] = "0"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o out/x1.cc -M out/=bar/ x1.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o out/x1.cc -M out/=bar/ x1.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o out/x1.cc -M out/=bar/ x1.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o out/x1.cc -M out/=bar/ x1.yy" "output.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o out/x1.cc -M out/=bar/ x1.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:775: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:775" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:775: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:775" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:775: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:775" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:775: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o out/x1.cc -M out/=bar/ x1.yy" at_fn_check_prepare_trace "output.at:775" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o out/x1.cc -M out/=bar/ x1.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:775" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:775" { set +x printf "%s\n" "$at_srcdir/output.at:775: \$CXX \$CPPFLAGS \$CXXFLAGS -Iout/include -c -o out/x1.o out/x1.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -Iout/include -c -o out/x1.o out/x1.cc " "output.at:775" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -Iout/include -c -o out/x1.o out/x1.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:775" $at_failed && at_fn_log_failure $at_traceon; } # Check the CPP guard and Doxyen comments. { set +x printf "%s\n" "$at_srcdir/output.at:782: sed -ne 's/#line [0-9][0-9]* \"/#line \"/p;/INCLUDED/p;/\\\\file/{p;n;p;}' out/include/ast/loc.hh" at_fn_check_prepare_trace "output.at:782" ( $at_check_trace; sed -ne 's/#line [0-9][0-9]* "/#line "/p;/INCLUDED/p;/\\file/{p;n;p;}' out/include/ast/loc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " ** \\file bar/include/ast/loc.hh ** Define the x1::location class. #ifndef YY_YY_BAR_INCLUDE_AST_LOC_HH_INCLUDED # define YY_YY_BAR_INCLUDE_AST_LOC_HH_INCLUDED #line \"x1.yy\" #line \"bar/include/ast/loc.hh\" #line \"x1.yy\" #line \"bar/include/ast/loc.hh\" #endif // !YY_YY_BAR_INCLUDE_AST_LOC_HH_INCLUDED " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:782" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:794: sed -ne 's/^#line [0-9][0-9]* \"/#line \"/p;/INCLUDED/p;/\\\\file/{p;n;p;}' out/x1.hh" at_fn_check_prepare_trace "output.at:794" ( $at_check_trace; sed -ne 's/^#line [0-9][0-9]* "/#line "/p;/INCLUDED/p;/\\file/{p;n;p;}' out/x1.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " ** \\file bar/x1.hh ** Define the x1::parser class. #ifndef YY_YY_BAR_X1_HH_INCLUDED # define YY_YY_BAR_X1_HH_INCLUDED #line \"x1.yy\" #line \"bar/x1.hh\" #line \"x1.yy\" #line \"bar/x1.hh\" #endif // !YY_YY_BAR_X1_HH_INCLUDED " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:794" $at_failed && at_fn_log_failure $at_traceon; } cat >x2.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.namespace {x2} %header %locations %code requires {#include "include/ast/loc.hh"} %define api.location.type {x1::location} %code { static int yylex (x2::parser::value_type *lvalp, x2::parser::location_type *llocp); } %% exp: '0'; %% /* A C++ error reporting function. */ void x2::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (x2::parser::value_type *lvalp, x2::parser::location_type *llocp) { static char const input[] = "0"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/output.at:806: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o out/x2.cc -M out/=bar/ x2.yy" at_fn_check_prepare_notrace 'an embedded newline' "output.at:806" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o out/x2.cc -M out/=bar/ x2.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:806: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o out/x2.cc -M out/=bar/ x2.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o out/x2.cc -M out/=bar/ x2.yy" "output.at:806" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o out/x2.cc -M out/=bar/ x2.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/output.at:806: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:806" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/output.at:806: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "output.at:806" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/output.at:806: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "output.at:806" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/output.at:806: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o out/x2.cc -M out/=bar/ x2.yy" at_fn_check_prepare_trace "output.at:806" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o out/x2.cc -M out/=bar/ x2.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "output.at:806" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:806" { set +x printf "%s\n" "$at_srcdir/output.at:806: \$CXX \$CPPFLAGS \$CXXFLAGS -Iout/include -c -o out/x2.o out/x2.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -Iout/include -c -o out/x2.o out/x2.cc " "output.at:806" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -Iout/include -c -o out/x2.o out/x2.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:806" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "x1.hh" #include "x2.hh" #define RUN(S) \ do { \ S::parser parser; \ int res = parser.parse(); \ if (res) \ std::cerr << #S": " << res << '\n'; \ } while (false) int main (void) { RUN(x1); RUN(x2); } _ATEOF # main.cc printf "%s\n" "output.at:835" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/output.at:835" { set +x printf "%s\n" "$at_srcdir/output.at:835: \$CXX \$CPPFLAGS \$CXXFLAGS -Iout/ \$LDFLAGS -o parser out/x[12].o main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -Iout/ $LDFLAGS -o parser out/x[12].o main.cc $LIBS" "output.at:835" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -Iout/ $LDFLAGS -o parser out/x[12].o main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/output.at:835" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:836: \$PREPARSER ./parser" at_fn_check_prepare_dynamic " $PREPARSER ./parser" "output.at:836" ( $at_check_trace; $PREPARSER ./parser ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:836" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/output.at:836: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "output.at:836" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/output.at:836" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_144 #AT_START_145 at_fn_group_banner 145 'diagnostics.at:84' \ "Warnings" " " 5 at_xfail=no ( printf "%s\n" "145. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:84" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:84" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token FOO FOO FOO %token FOO FOO FOO %% exp: %empty; _ATEOF cat >experr <<'_ATEOF' input.y:9.12-14: warning: symbol FOO redeclared [-Wother] 9 | %token FOO FOO FOO | ^~~ input.y:9.8-10: note: previous declaration 9 | %token FOO FOO FOO | ^~~ input.y:9.16-18: warning: symbol FOO redeclared [-Wother] 9 | %token FOO FOO FOO | ^~~ input.y:9.8-10: note: previous declaration 9 | %token FOO FOO FOO | ^~~ input.y:10.8-10: warning: symbol FOO redeclared [-Wother] 10 | %token FOO FOO FOO | ^~~ input.y:9.8-10: note: previous declaration 9 | %token FOO FOO FOO | ^~~ input.y:10.13-15: warning: symbol FOO redeclared [-Wother] 10 | %token FOO FOO FOO | ^~~ input.y:9.8-10: note: previous declaration 9 | %token FOO FOO FOO | ^~~ input.y:10.18-20: warning: symbol FOO redeclared [-Wother] 10 | %token FOO FOO FOO | ^~~ input.y:9.8-10: note: previous declaration 9 | %token FOO FOO FOO | ^~~ _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:84: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:84" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:84" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:84: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:84" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:84" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:84: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:84" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:84" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:84: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:84" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:84" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_145 #AT_START_146 at_fn_group_banner 146 'diagnostics.at:133' \ "Single point locations" " " 5 at_xfail=no ( printf "%s\n" "146. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:133" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:133" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: a b c d e a: {} b:{ }; c: d : e: _ATEOF cat >experr <<'_ATEOF' input.y:11.4-5: warning: empty rule without %empty [-Wempty-rule] 11 | a: {} | ^~ | %empty input.y:12.3-13.1: warning: empty rule without %empty [-Wempty-rule] 12 | b:{ | ^ | %empty input.y:14.3: warning: empty rule without %empty [-Wempty-rule] 14 | c: | ^ | %empty input.y:16.2: warning: empty rule without %empty [-Wempty-rule] 16 | : | ^ | %empty input.y:17.3: warning: empty rule without %empty [-Wempty-rule] 17 | e: | ^ | %empty input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:133: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:133" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:133" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:133" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:133: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:133" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:133" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:133" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_146 #AT_START_147 at_fn_group_banner 147 'diagnostics.at:182' \ "Line is too short, and then you die" " " 5 at_xfail=no ( printf "%s\n" "147. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:182" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:182" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } // Beware that there are 9 lines inserted before (including this one). #line 12 %token foo 123 %token foo 123123 %token foo 123 %% exp: _ATEOF cat >experr <<'_ATEOF' input.y:13.8-10: warning: symbol foo redeclared [-Wother] 13 | %token foo 123 | ^~~ input.y:12.8-10: note: previous declaration 12 | %token foo 123123 | ^~~ input.y:13.12-17: error: redefining code of token foo 13 | %token foo 123 | ^~~~~~ input.y:14.8-10: warning: symbol foo redeclared [-Wother] 14 | %% | ^~~ input.y:12.8-10: note: previous declaration 12 | %token foo 123123 | ^~~ _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:182: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:182" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:182" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:182" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:182: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:182" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:182" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:182" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_147 #AT_START_148 at_fn_group_banner 148 'diagnostics.at:217' \ "Zero-width characters" " " 5 at_xfail=no ( printf "%s\n" "148. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:217" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:217" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: an\005error. _ATEOF cat >experr <<'_ATEOF' input.y:10.8: error: invalid character: '\\005' 10 | exp: an\005error. | ^ _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:217: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:217" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:217" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:217: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:217" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:217" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:217: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:217" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:217" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:217: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:217" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:217" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_148 #AT_START_149 at_fn_group_banner 149 'diagnostics.at:235' \ "Tabulations and multibyte characters" " " 5 at_xfail=no ( printf "%s\n" "149. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:235" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:235" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: a b c d e f g a: { } b: { } c: {------------} d: {éééééééééééé} e: { 42 } f: { "฿¥$€₦" } g: { 🐃 } _ATEOF cat >experr <<'_ATEOF' input.y:11.4-17: warning: empty rule without %empty [-Wempty-rule] 11 | a: { } | ^~~~~~~~~~~~~~ | %empty input.y:12.4-17: warning: empty rule without %empty [-Wempty-rule] 12 | b: { } | ^~~~~~~~~~~~~~ | %empty input.y:13.4-17: warning: empty rule without %empty [-Wempty-rule] 13 | c: {------------} | ^~~~~~~~~~~~~~ | %empty input.y:14.4-17: warning: empty rule without %empty [-Wempty-rule] 14 | d: {éééééééééééé} | ^~~~~~~~~~~~~~ | %empty input.y:15.4-17: warning: empty rule without %empty [-Wempty-rule] 15 | e: { 42 } | ^~~~~~~~~~~~~~ | %empty input.y:16.4-17: warning: empty rule without %empty [-Wempty-rule] 16 | f: { "฿¥$€₦" } | ^~~~~~~~~~~~~~ | %empty input.y:17.4-17: warning: empty rule without %empty [-Wempty-rule] 17 | g: { 🐃 } | ^~~~~~~~~~~~~~ | %empty input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:235: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:235" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:235" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:235: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:235" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:235" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:235: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:235" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:235" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:235: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:235" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:235" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_149 #AT_START_150 at_fn_group_banner 150 'diagnostics.at:282' \ "Tabulations and multibyte characters" " " 5 at_xfail=no ( printf "%s\n" "150. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:282" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:282" printf "%s\n" "diagnostics.at:282" >"$at_check_line_file" (uname -a | $EGREP -i 'aix|cygwin') \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:282" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t} _ATEOF cat >experr <<'_ATEOF' input.y:10.4-17: warning: empty rule without %empty [-Wempty-rule] 10 | e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t} | ^~~~~~~~~~~~~~ | %empty input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:282: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:282" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:282" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:282: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:282" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:282" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:282: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:282" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:282" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:282: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:282" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:282" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_150 #AT_START_151 at_fn_group_banner 151 'diagnostics.at:303' \ "Special files" " " 5 at_xfail=no ( printf "%s\n" "151. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:303" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:303" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: a b a: {} #line 1 "/dev/stdout" b: {} _ATEOF cat >experr <<'_ATEOF' input.y:11.4-5: warning: empty rule without %empty [-Wempty-rule] 11 | a: {} | ^~ | %empty /dev/stdout:1.4-5: warning: empty rule without %empty [-Wempty-rule] | %empty input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:303: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:303" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:303" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:303: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:303" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:303" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:303: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:303" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:303" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:303: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:303" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:303" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_151 #AT_START_152 at_fn_group_banner 152 'diagnostics.at:328' \ "Complaints from M4" " " 5 at_xfail=no ( printf "%s\n" "152. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:328" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:328" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define error1 {e} %define error2 {é} %% exp: %empty; _ATEOF cat >experr <<'_ATEOF' input.y:9.1-27: error: %define variable 'error1' is not used 9 | %define error1 {e} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:10.1-27: error: %define variable 'error2' is not used 10 | %define error2 {é} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:328: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:328" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:328" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:328" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:328: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:328" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:328" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:328" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_152 #AT_START_153 at_fn_group_banner 153 'diagnostics.at:351' \ "Carriage return" " " 5 at_xfail=no ( printf "%s\n" "153. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:351" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:351" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } ^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M %token " %% _ATEOF cat >experr <<'_ATEOF' input.y:10.8-11.0: error: missing '"' at end of line 10 | %token " | ^ input.y:10.8-11.0: error: expected character literal or identifier or before string 10 | %token " | ^ _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:351: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:351" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:351" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:351: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:351" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:351" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:351: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:351" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:351" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:351: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:351" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:351" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_153 #AT_START_154 at_fn_group_banner 154 'diagnostics.at:372' \ "CR NL" " " 5 at_xfail=no ( printf "%s\n" "154. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:372" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:372" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } ^M %token ^M FOO^M %token ^M FOO^M %%^M exp:^M _ATEOF cat >experr <<'_ATEOF' input.y:11.9-11: warning: symbol FOO redeclared [-Wother] 11 | %token FOO | ^~~ input.y:10.9-11: note: previous declaration 10 | %token FOO | ^~~ input.y:13.5: warning: empty rule without %empty [-Wempty-rule] 13 | exp: | ^ | %empty input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:372: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:372" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:372" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:372" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:372: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:372" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:372" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:372" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_154 #AT_START_155 at_fn_group_banner 155 'diagnostics.at:399' \ "Screen width: 200 columns" " " 5 at_xfail=no ( printf "%s\n" "155. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:399" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:399" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ %error-verbose %% exp: ABCDEFGHIJKLMNOPQRSTUVWXYZ _ATEOF cat >experr <<'_ATEOF' input.y:9.36-61: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.64-89: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.92-117: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:10.56-69: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated] 10 | %error-verbose | ^~~~~~~~~~~~~~ | %define parse.error verbose input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:399: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:399" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:399" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:399: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" COLUMNS=200 bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" COLUMNS=200 bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:399" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" COLUMNS=200 bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:399" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:399: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:399" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:399" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:399: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" COLUMNS=200 bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" COLUMNS=200 bison -fcaret -Wall,cex input.y" "diagnostics.at:399" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" COLUMNS=200 bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:399" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_155 #AT_START_156 at_fn_group_banner 156 'diagnostics.at:432' \ "Screen width: 80 columns" " " 5 at_xfail=no ( printf "%s\n" "156. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:432" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:432" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ %error-verbose %% exp: ABCDEFGHIJKLMNOPQRSTUVWXYZ _ATEOF cat >experr <<'_ATEOF' input.y:9.36-61: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEF... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEF... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.64-89: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEF... | ^~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEF... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.92-117: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEF... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:10.56-69: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated] 10 | %error-verbose | ^~~~~~~~~~~~~~ | %define parse.error verbose input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:432: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:432" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:432" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" COLUMNS=80 bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" COLUMNS=80 bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" COLUMNS=80 bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:432" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:432: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:432" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:432" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" COLUMNS=80 bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" COLUMNS=80 bison -fcaret -Wall,cex input.y" "diagnostics.at:432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" COLUMNS=80 bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:432" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_156 #AT_START_157 at_fn_group_banner 157 'diagnostics.at:465' \ "Screen width: 60 columns" " " 5 at_xfail=no ( printf "%s\n" "157. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:465" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:465" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ %error-verbose %% exp: ABCDEFGHIJKLMNOPQRSTUVWXYZ _ATEOF cat >experr <<'_ATEOF' input.y:9.36-61: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMN... | ^~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMN... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.64-89: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHI... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMN... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.92-117: warning: symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [-Wother] 9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:9.8-33: note: previous declaration 9 | %token ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMN... | ^~~~~~~~~~~~~~~~~~~~~~~~~~ input.y:10.56-69: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated] 10 | ... %error-verbose | ^~~~~~~~~~~~~~ | %define parse.error verbose input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:465: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:465" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:465" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:465: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" COLUMNS=60 bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" COLUMNS=60 bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:465" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" COLUMNS=60 bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:465" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:465: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:465" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:465" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:465: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" COLUMNS=60 bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" COLUMNS=60 bison -fcaret -Wall,cex input.y" "diagnostics.at:465" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" COLUMNS=60 bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:465" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_157 #AT_START_158 at_fn_group_banner 158 'diagnostics.at:504' \ "Suggestions" " " 5 at_xfail=no ( printf "%s\n" "158. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:504" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:504" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% res: QUX baz bar: QUUX _ATEOF cat >experr <<'_ATEOF' input.y:10.6-8: error: symbol 'QUX' is used, but is not defined as a token and has no rules 10 | res: QUX baz | ^~~ input.y:10.10-12: error: symbol 'baz' is used, but is not defined as a token and has no rules; did you mean 'bar'? 10 | res: QUX baz | ^~~ | bar input.y:11.6-9: error: symbol 'QUUX' is used, but is not defined as a token and has no rules 11 | bar: QUUX | ^~~~ _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:504: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:504" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:504" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:504: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:504" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:504" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:504: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:504" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:504" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:504: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:504" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:504" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_158 #AT_START_159 at_fn_group_banner 159 'diagnostics.at:527' \ "Counterexamples" " " 5 at_xfail=no ( printf "%s\n" "159. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:527" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:527" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %expect 0 %% exp : "if" exp "then" exp | "if" exp "then" exp "else" exp | exp "+" exp | "num" | empty "a" | "a" empty empty : %empty _ATEOF cat >experr <<'_ATEOF' input.y: error: shift/reduce conflicts: 9 found, 0 expected input.y: warning: shift/reduce conflict on token "a" [-Wcounterexamples] Example: "a" Shift derivation exp ↳ 6: "a" empty ↳ 6: ε Example: "a" Reduce derivation exp ↳ 5: empty "a" ↳ 7: ε input.y: warning: shift/reduce conflict on token "a" [-Wcounterexamples] Example: "a" Shift derivation exp ↳ 6: "a" empty ↳ 6: ε Example: "a" Reduce derivation exp ↳ 5: empty "a" ↳ 7: ε input.y: warning: shift/reduce conflict on token "a" [-Wcounterexamples] Example: "a" Shift derivation exp ↳ 6: "a" empty ↳ 6: ε Example: "a" Reduce derivation exp ↳ 5: empty "a" ↳ 7: ε input.y: warning: shift/reduce conflict on token "a" [-Wcounterexamples] Example: "a" Shift derivation exp ↳ 6: "a" empty ↳ 6: ε Example: "a" Reduce derivation exp ↳ 5: empty "a" ↳ 7: ε input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples] Example: exp "+" exp "+" exp Shift derivation exp ↳ 3: exp "+" exp ↳ 3: exp "+" exp Example: exp "+" exp "+" exp Reduce derivation exp ↳ 3: exp "+" exp ↳ 3: exp "+" exp input.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples] Example: "if" exp "then" "if" exp "then" exp "else" exp Shift derivation exp ↳ 1: "if" exp "then" exp ↳ 2: "if" exp "then" exp "else" exp Example: "if" exp "then" "if" exp "then" exp "else" exp Reduce derivation exp ↳ 2: "if" exp "then" exp "else" exp ↳ 1: "if" exp "then" exp input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples] Example: "if" exp "then" exp "+" exp Shift derivation exp ↳ 1: "if" exp "then" exp ↳ 3: exp "+" exp Example: "if" exp "then" exp "+" exp Reduce derivation exp ↳ 3: exp "+" exp ↳ 1: "if" exp "then" exp input.y: warning: shift/reduce conflict on token "a" [-Wcounterexamples] Example: "a" Shift derivation exp ↳ 6: "a" empty ↳ 6: ε Example: "a" Reduce derivation exp ↳ 5: empty "a" ↳ 7: ε input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples] Example: "if" exp "then" exp "else" exp "+" exp Shift derivation exp ↳ 2: "if" exp "then" exp "else" exp ↳ 3: exp "+" exp Example: "if" exp "then" exp "else" exp "+" exp Reduce derivation exp ↳ 3: exp "+" exp ↳ 2: "if" exp "then" exp "else" exp _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:527: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:527" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:527" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:527: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:527" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:527" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:527: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:527" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:527" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:527: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:527" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:527" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_159 #AT_START_160 at_fn_group_banner 160 'diagnostics.at:645' \ "Deep Counterexamples" " " 5 at_xfail=no ( printf "%s\n" "160. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "diagnostics.at:645" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/diagnostics.at:645" cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %expect 0 %% exp: x1 e1 foo1 x1 | y1 e2 bar1 y1 foo1: foo2 foo2: foo3 foo3: x1 foo4 foo4: "quuux" bar1: bar2 bar2: bar3 bar3: y1 bar4 bar4: "quuux" x1: x2 x2: x3 x3: "X" y1: y2 y2: y3 y3: "X" e1: e2: _ATEOF cat >experr <<'_ATEOF' input.y:30.4: warning: empty rule without %empty [-Wempty-rule] 30 | e1: | ^ | %empty input.y:31.4: warning: empty rule without %empty [-Wempty-rule] 31 | e2: | ^ | %empty input.y: error: reduce/reduce conflicts: 1 found, 0 expected input.y: warning: reduce/reduce conflict on token "X" [-Wcounterexamples] Example: "X" "X" "quuux" "X" First reduce derivation exp ↳ 1: x1 e1 foo1 x1 ↳ 11: x2 ↳ 1: ε ↳ 3: foo2 ↳ 11: x2 ↳ 12: x3 ↳ 4: foo3 ↳ 12: x3 ↳ 13: "X" ↳ 5: x1 foo4 ↳ 13: "X" ↳ 11: x2 ↳ 6: "quuux" ↳ 12: x3 ↳ 13: "X" Example: "X" "X" "quuux" "X" Second reduce derivation exp ↳ 2: y1 e2 bar1 y1 ↳ 14: y2 ↳ 2: ε ↳ 7: bar2 ↳ 14: y2 ↳ 15: y3 ↳ 8: bar3 ↳ 15: y3 ↳ 16: "X" ↳ 9: y1 bar4 ↳ 16: "X" ↳ 14: y2 ↳ 10: "quuux" ↳ 15: y3 ↳ 16: "X" input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF # For some reason, literal ^M in the input are removed and don't end # in `input.y`. So use the two-character ^M represent it, and let # Perl insert real CR characters. if $EGREP '\^M|\\[0-9][0-9][0-9]' input.y experr >/dev/null; then { set +x printf "%s\n" "$at_srcdir/diagnostics.at:645: \"\$PERL\" -pi -e 's{\\^M}{\\r}g;s{\\\\(\\d{3}|.)}{\$v = \$1; \$v =~ /\\A\\d+\\z/ ? chr(\$v) : \$v}ge' input.y experr || exit 77" at_fn_check_prepare_notrace 'a shell pipeline' "diagnostics.at:645" ( $at_check_trace; "$PERL" -pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:645" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:645: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret --color=debug -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret --color=debug -Wall,cex input.y" "diagnostics.at:645" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret --color=debug -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:645" $at_failed && at_fn_log_failure $at_traceon; } # When no style, same messages, but without style. # Except for the second display of the counterexample, # which is not displayed at all. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:645: \"\$PERL\" -pi -e ' s{()}{ \$1 eq \"\" ? \$1 : \"\" }ge; if (/Example/) { ++\$example; \$_ = \"\" if \$example % 2 == 0; } ' experr || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:645" ( $at_check_trace; "$PERL" -pi -e ' s{()}{ $1 eq "" ? $1 : "" }ge; if (/Example/) { ++$example; $_ = "" if $example % 2 == 0; } ' experr || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:645" $at_failed && at_fn_log_failure $at_traceon; } # Cannot use AT_BISON_CHECK easily as we need to change the # environment. # FIXME: Enhance AT_BISON_CHECK. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:645: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"\$locale\" bison -fcaret -Wall,cex input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; LC_ALL=\"$locale\" bison -fcaret -Wall,cex input.y" "diagnostics.at:645" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; LC_ALL="$locale" bison -fcaret -Wall,cex input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:645" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_160 #AT_START_161 at_fn_group_banner 161 'diagnostics.at:713' \ "Indentation with message suppression" " " 5 at_xfail=no ( printf "%s\n" "161. $at_setup_line: testing $at_desc ..." $at_traceon # https://lists.gnu.org/r/bug-bison/2019-08/msg00002.html cat >input.y <<'_ATEOF' %define api.pure %pure-parser %error-verbose %% exp : '0' _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wno-other input.y" at_fn_check_prepare_notrace 'an embedded newline' "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wno-other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wno-other input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wno-other input.y" "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wno-other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "diagnostics.at:725" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "diagnostics.at:725" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "diagnostics.at:725" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wno-other input.y" at_fn_check_prepare_trace "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wno-other input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-12: warning: deprecated directive: '%pure-parser', use '%define api.pure' [-Wdeprecated] 2 | %pure-parser | ^~~~~~~~~~~~ | %define api.pure input.y:3.1-14: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated] 3 | %error-verbose | ^~~~~~~~~~~~~~ | %define parse.error verbose " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y -Werror" "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.1-12: warning: deprecated directive: '%pure-parser', use '%define api.pure' [-Wdeprecated] 2 | %pure-parser | ^~~~~~~~~~~~ | %define api.pure input.y:3.1-14: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated] 3 | %error-verbose | ^~~~~~~~~~~~~~ | %define parse.error verbose _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "diagnostics.at:725" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y --warnings=error" "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y -Wnone,none -Werror --trace=none" "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/diagnostics.at:725: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y --warnings=none -Werror --trace=none" "diagnostics.at:725" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wno-other input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/diagnostics.at:725" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_161 #AT_START_162 at_fn_group_banner 162 'skeletons.at:25' \ "Relative skeleton file names" " " 6 at_xfail=no ( printf "%s\n" "162. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/skeletons.at:27: mkdir tmp" at_fn_check_prepare_trace "skeletons.at:27" ( $at_check_trace; mkdir tmp ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:27" $at_failed && at_fn_log_failure $at_traceon; } cat >tmp/skel.c <<'_ATEOF' m4_divert_push(0)dnl @output(b4_parser_file_name@)dnl b4_percent_define_get([[test]]) m4_divert_pop(0) _ATEOF cat >skel.c <<'_ATEOF' m4_divert_push(0)dnl @output(b4_parser_file_name@)dnl b4_percent_define_get([[test]]) -- Local m4_divert_pop(0) _ATEOF cat >tmp/input-gram.y <<'_ATEOF' %skeleton "./skel.c" %define test "Hello World" %% start: ; _ATEOF cat >input-gram.y <<'_ATEOF' %skeleton "./skel.c" %define test "Hello World" %% start: ; _ATEOF cat >tmp/input-cmd-line.y <<'_ATEOF' %define test "Hello World" %% start: ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/skeletons.at:63: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv tmp/input-gram.y" at_fn_check_prepare_notrace 'an embedded newline' "skeletons.at:63" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv tmp/input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:63" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:63: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml tmp/input-gram.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml tmp/input-gram.y" "skeletons.at:63" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml tmp/input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:63" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:63: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:63" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:63" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/skeletons.at:63: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "skeletons.at:63" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:63" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:63: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:63" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:63" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/skeletons.at:63: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret tmp/input-gram.y" at_fn_check_prepare_trace "skeletons.at:63" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret tmp/input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:63" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:64: cat input-gram.tab.c" at_fn_check_prepare_trace "skeletons.at:64" ( $at_check_trace; cat input-gram.tab.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Hello World " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:64" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/skeletons.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input-gram.y" at_fn_check_prepare_notrace 'an embedded newline' "skeletons.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:68" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input-gram.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input-gram.y" "skeletons.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:68" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:68: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:68" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:68" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/skeletons.at:68: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "skeletons.at:68" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:68" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:68: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:68" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:68" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/skeletons.at:68: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input-gram.y" at_fn_check_prepare_trace "skeletons.at:68" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:68" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:69: cat input-gram.tab.c" at_fn_check_prepare_trace "skeletons.at:69" ( $at_check_trace; cat input-gram.tab.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Hello World -- Local " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:69" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/skeletons.at:73: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --skeleton=tmp/skel.c tmp/input-cmd-line.y" at_fn_check_prepare_notrace 'an embedded newline' "skeletons.at:73" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:73" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:73: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --skeleton=tmp/skel.c tmp/input-cmd-line.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --skeleton=tmp/skel.c tmp/input-cmd-line.y" "skeletons.at:73" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:73" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:73: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:73" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:73" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/skeletons.at:73: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "skeletons.at:73" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:73" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:73: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:73" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:73" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/skeletons.at:73: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --skeleton=tmp/skel.c tmp/input-cmd-line.y" at_fn_check_prepare_trace "skeletons.at:73" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --skeleton=tmp/skel.c tmp/input-cmd-line.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:73" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:74: cat input-cmd-line.tab.c" at_fn_check_prepare_trace "skeletons.at:74" ( $at_check_trace; cat input-cmd-line.tab.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Hello World " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:74" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_162 #AT_START_163 at_fn_group_banner 163 'skeletons.at:85' \ "Installed skeleton file names" " " 6 at_xfail=no ( printf "%s\n" "163. $at_setup_line: testing $at_desc ..." $at_traceon cat >input-cmd-line.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); %} %define parse.error verbose %token 'a' %% start: ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (void) { return 'a'; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF cat >input-gram.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "yacc.c" %{ #include #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); %} %define parse.error verbose %token 'a' %% start: ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (void) { return 'a'; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/skeletons.at:120: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" at_fn_check_prepare_notrace 'an embedded newline' "skeletons.at:120" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:120" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:120: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" "skeletons.at:120" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:120" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:120: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:120" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:120" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/skeletons.at:120: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "skeletons.at:120" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:120" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:120: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:120" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:120" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/skeletons.at:120: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y" at_fn_check_prepare_trace "skeletons.at:120" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:120" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "skeletons.at:121" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/skeletons.at:121" { set +x printf "%s\n" "$at_srcdir/skeletons.at:121: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input-cmd-line input-cmd-line.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-cmd-line input-cmd-line.c $LIBS" "skeletons.at:121" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-cmd-line input-cmd-line.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:121" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:122: \$PREPARSER ./input-cmd-line" at_fn_check_prepare_dynamic " $PREPARSER ./input-cmd-line" "skeletons.at:122" ( $at_check_trace; $PREPARSER ./input-cmd-line ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:122" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:122: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "skeletons.at:122" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:122" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/skeletons.at:126: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input-gram.c input-gram.y" at_fn_check_prepare_notrace 'an embedded newline' "skeletons.at:126" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input-gram.c input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:126" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:126: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input-gram.c input-gram.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input-gram.c input-gram.y" "skeletons.at:126" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input-gram.c input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:126" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:126: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:126" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:126" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/skeletons.at:126: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "skeletons.at:126" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:126" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/skeletons.at:126: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "skeletons.at:126" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:126" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/skeletons.at:126: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input-gram.c input-gram.y" at_fn_check_prepare_trace "skeletons.at:126" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input-gram.c input-gram.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:126" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "skeletons.at:127" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/skeletons.at:127" { set +x printf "%s\n" "$at_srcdir/skeletons.at:127: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input-gram input-gram.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-gram input-gram.c $LIBS" "skeletons.at:127" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input-gram input-gram.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:127" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:128: \$PREPARSER ./input-gram" at_fn_check_prepare_dynamic " $PREPARSER ./input-gram" "skeletons.at:128" ( $at_check_trace; $PREPARSER ./input-gram ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:128" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/skeletons.at:128: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "skeletons.at:128" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:128" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_163 #AT_START_164 at_fn_group_banner 164 'skeletons.at:142' \ "Boolean=variables: invalid skeleton defaults" " " 6 at_xfail=no ( printf "%s\n" "164. $at_setup_line: testing $at_desc ..." $at_traceon cat >skel.c <<'_ATEOF' b4_percent_define_default([[foo]], [[bogus value]]) b4_percent_define_flag_if([[foo]]) _ATEOF cat >input.y <<'_ATEOF' %skeleton "./skel.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:155: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "skeletons.at:155" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" ": error: invalid value for %define Boolean variable 'foo' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:155" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_164 #AT_START_165 at_fn_group_banner 165 'skeletons.at:166' \ "Complaining during macro argument expansion" " " 6 at_xfail=no ( printf "%s\n" "165. $at_setup_line: testing $at_desc ..." $at_traceon cat >skel1.c <<'_ATEOF' m4_define([foow], [b4_warn([[foow fubar]])]) m4_define([foowat], [b4_warn_at([[foow.y:2.3]], [[foow.y:5.4]], [[foowat fubar]])]) m4_define([fooc], [b4_complain([[fooc fubar]])]) m4_define([foocat], [b4_complain_at([[fooc.y:1.1]], [[fooc.y:10.6]], [[foocat fubar]])]) m4_define([foof], [b4_fatal([[foof fubar]])]) m4_if(foow, [1], [yes]) m4_if(foowat, [1], [yes]) m4_if(fooc, [1], [yes]) m4_if(foocat, [1], [yes]) m4_if(foof, [1], [yes]) _ATEOF cat >input1.y <<'_ATEOF' %skeleton "./skel1.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:189: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input1.y" "skeletons.at:189" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input1.y: warning: foow fubar [-Wother] foow.y:2.3-5.3: warning: foowat fubar [-Wother] input1.y: error: fooc fubar fooc.y:1.1-10.5: error: foocat fubar input1.y: fatal error: foof fubar " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:189" $at_failed && at_fn_log_failure $at_traceon; } cat >skel2.c <<'_ATEOF' m4_define([foofat], [b4_fatal_at([[foof.y:12.11]], [[foof.y:100.123]], [[foofat fubar]])]) m4_if(foofat, [1], [yes]) _ATEOF cat >input2.y <<'_ATEOF' %skeleton "./skel2.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:209: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input2.y" "skeletons.at:209" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "foof.y:12.11-100.122: fatal error: foofat fubar " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:209" $at_failed && at_fn_log_failure $at_traceon; } cat >skel3.c <<'_ATEOF' b4_complain_at(b4_percent_define_get_loc([[bogus]]), [[bad value]]) _ATEOF cat >input3.y <<'_ATEOF' %skeleton "./skel3.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:223: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input3.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input3.y" "skeletons.at:223" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input3.y: fatal error: b4_percent_define_get_loc: undefined %define variable 'bogus' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:223" $at_failed && at_fn_log_failure $at_traceon; } cat >skel4.c <<'_ATEOF' b4_warn_at(b4_percent_define_get_syncline([[bogus]]), [[bad value]]) _ATEOF cat >input4.y <<'_ATEOF' %skeleton "./skel4.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:237: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input4.y" "skeletons.at:237" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input4.y: fatal error: b4_percent_define_get_syncline: undefined %define variable 'bogus' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:237" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_165 #AT_START_166 at_fn_group_banner 166 'skeletons.at:248' \ "Fatal errors make M4 exit immediately" " " 6 at_xfail=no ( printf "%s\n" "166. $at_setup_line: testing $at_desc ..." $at_traceon cat >skel1.c <<'_ATEOF' b4_complain([[non-fatal error]]) b4_fatal([[M4 should exit immediately here]]) m4_fatal([this should never be evaluated]) _ATEOF cat >input1.y <<'_ATEOF' %skeleton "./skel1.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:262: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input1.y" "skeletons.at:262" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input1.y: error: non-fatal error input1.y: fatal error: M4 should exit immediately here " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:262" $at_failed && at_fn_log_failure $at_traceon; } cat >skel2.c <<'_ATEOF' b4_warn([[morning]]) b4_fatal_at([[foo.y:1.5]], [[foo.y:1.7]], [[M4 should exit immediately here]]) m4_fatal([this should never be evaluated]) _ATEOF cat >input2.y <<'_ATEOF' %skeleton "./skel2.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:279: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input2.y" "skeletons.at:279" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input2.y: warning: morning [-Wother] foo.y:1.5-6: fatal error: M4 should exit immediately here " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:279" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_166 #AT_START_167 at_fn_group_banner 167 'skeletons.at:302' \ "Fatal errors but M4 continues producing output" " " 6 at_xfail=no ( printf "%s\n" "167. $at_setup_line: testing $at_desc ..." $at_traceon cat >gen-skel.pl <<'_ATEOF' use warnings; use strict; my $M4 = "m4"; my $DNL = "d"."nl"; print "${M4}_divert_push(0)$DNL\n"; print '@output(@,@,@)', "\n"; (print "garbage"x10, "\n") for (1..1000); print "${M4}_divert_pop(0)\n"; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:314: \"\$PERL\" gen-skel.pl > skel.c || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" gen-skel.pl > skel.c || exit 77" "skeletons.at:314" ( $at_check_trace; "$PERL" gen-skel.pl > skel.c || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/skeletons.at:314" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %skeleton "./skel.c" %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/skeletons.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "skeletons.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: fatal error: too many arguments for @output directive in skeleton " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/skeletons.at:322" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_167 #AT_START_168 at_fn_group_banner 168 'sets.at:27' \ "Nullable" " " 7 at_xfail=no ( printf "%s\n" "168. $at_setup_line: testing $at_desc ..." $at_traceon # At some point, nullable had been smoking grass, and managed to say: # # Entering set_nullable # NULLABLE # 'e': yes # (null): no # ... cat >input.y <<'_ATEOF' %% e: 'e' | /* Nothing */; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:42: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --trace=sets input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:42" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:42" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:42: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y" "sets.at:42" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:42" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:42: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:42" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:42" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:42: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:42" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:42" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:42: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:42" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:42" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:42: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=sets input.y" at_fn_check_prepare_trace "sets.at:42" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:42" $at_failed && at_fn_log_failure $at_traceon; } cat >extract.sed <<'_ATEOF' #n /^DERIVES/ { :DERIVES p n /^ *$/ !b DERIVES } /^NULLABLE/ { :NULLABL p n /^ *$/ !b NULLABL } /^FIRSTS/ { :FIRSTS p n /^ *$/ !b FIRSTS } /^FDERIVES/ { :FDERIVE p n /^ *$/ !b FDERIVE } _ATEOF { set +x printf "%s\n" "$at_srcdir/sets.at:43: sed -f extract.sed stderr" at_fn_check_prepare_trace "sets.at:43" ( $at_check_trace; sed -f extract.sed stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "DERIVES \$accept derives 0 e \$end e derives 1 'e' 2 %empty NULLABLE \$accept: no e: yes FIRSTS \$accept firsts \$accept e e firsts e FDERIVES \$accept derives 0 e \$end 1 'e' 2 %empty e derives 1 'e' 2 %empty " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:43" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_168 #AT_START_169 at_fn_group_banner 169 'sets.at:111' \ "Broken Closure" " " 7 at_xfail=no ( printf "%s\n" "169. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% a: b; b: c; c: d; d: e; e: f; f: g; g: h; h: 'h'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:125: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --trace=sets input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:125" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:125" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:125: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y" "sets.at:125" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:125" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:125: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:125" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:125" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:125: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:125" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:125" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:125: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:125" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:125" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:125: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=sets input.y" at_fn_check_prepare_trace "sets.at:125" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:125" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:127: sed -n 's/[ ]*\$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr" at_fn_check_prepare_dynamic "sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr" "sets.at:127" ( $at_check_trace; sed -n 's/[ ]*$//;/^RTC: Firsts Output BEGIN/,/^RTC: Firsts Output END/p' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "RTC: Firsts Output BEGIN 012345678 .---------. 0|111111111| 1| 11111111| 2| 1111111| 3| 111111| 4| 11111| 5| 1111| 6| 111| 7| 11| 8| 1| \`---------' RTC: Firsts Output END " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:127" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_169 #AT_START_170 at_fn_group_banner 170 'sets.at:153' \ "Firsts" " " 7 at_xfail=no ( printf "%s\n" "170. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %nonassoc '<' '>' %left '+' '-' %right '^' '=' %% exp: exp '<' exp | exp '>' exp | exp '+' exp | exp '-' exp | exp '^' exp | exp '=' exp | "exp" ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:171: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --trace=sets input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:171" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:171" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:171: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y" "sets.at:171" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:171" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:171: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:171" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:171" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:171: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:171" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:171" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:171: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:171" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:171" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:171: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=sets input.y" at_fn_check_prepare_trace "sets.at:171" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=sets input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:171" $at_failed && at_fn_log_failure $at_traceon; } cat >extract.sed <<'_ATEOF' #n /^DERIVES/ { :DERIVES p n /^ *$/ !b DERIVES } /^NULLABLE/ { :NULLABL p n /^ *$/ !b NULLABL } /^FIRSTS/ { :FIRSTS p n /^ *$/ !b FIRSTS } /^FDERIVES/ { :FDERIVE p n /^ *$/ !b FDERIVE } _ATEOF { set +x printf "%s\n" "$at_srcdir/sets.at:172: sed -f extract.sed stderr" at_fn_check_prepare_trace "sets.at:172" ( $at_check_trace; sed -f extract.sed stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "DERIVES \$accept derives 0 exp \$end exp derives 1 exp '<' exp 2 exp '>' exp 3 exp '+' exp 4 exp '-' exp 5 exp '^' exp 6 exp '=' exp 7 \"exp\" NULLABLE \$accept: no exp: no FIRSTS \$accept firsts \$accept exp exp firsts exp FDERIVES \$accept derives 0 exp \$end 1 exp '<' exp 2 exp '>' exp 3 exp '+' exp 4 exp '-' exp 5 exp '^' exp 6 exp '=' exp 7 \"exp\" exp derives 1 exp '<' exp 2 exp '>' exp 3 exp '+' exp 4 exp '-' exp 5 exp '^' exp 6 exp '=' exp 7 \"exp\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:172" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_170 #AT_START_171 at_fn_group_banner 171 'sets.at:228' \ "Accept" " " 7 at_xfail=no ( printf "%s\n" "171. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token END 0 %% input: 'a' | '(' input ')' | '(' error END ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:240: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:240" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:240" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:240: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" "sets.at:240" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:240" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:240: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:240" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:240" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:240: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:240" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:240" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:240: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:240" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:240" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:240: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y" at_fn_check_prepare_trace "sets.at:240" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:240" $at_failed && at_fn_log_failure $at_traceon; } # Get the final state in the parser. { set +x printf "%s\n" "$at_srcdir/sets.at:243: sed -n 's/.*define YYFINAL *\\([0-9][0-9]*\\)/final state \\1/p' input.c" at_fn_check_prepare_trace "sets.at:243" ( $at_check_trace; sed -n 's/.*define YYFINAL *\([0-9][0-9]*\)/final state \1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:243" $at_failed && at_fn_log_failure $at_traceon; } mv stdout expout # Get the final state in the report, from the "accept" action.. { set +x printf "%s\n" "$at_srcdir/sets.at:248: sed -n ' /^State \\(.*\\)/{ s//final state \\1/ x } / accept/{ x p q } ' input.output" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:248" ( $at_check_trace; sed -n ' /^State \(.*\)/{ s//final state \1/ x } / accept/{ x p q } ' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:248" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_171 #AT_START_172 at_fn_group_banner 172 'sets.at:269' \ "Build relations" " " 7 at_xfail=no ( printf "%s\n" "172. $at_setup_line: testing $at_desc ..." $at_traceon # The "includes" relation [DeRemer 1982] is between gotos, so of # course, for a given goto, there cannot be more that ngotos (number # of gotos) images. But we manipulate the set of images of a goto as # a list, without checking that an image was not already introduced. # So we can "register" way more images than ngotos, leading to a crash # (heap buffer overflow). # # https://lists.gnu.org/r/bug-bison/2019-03/msg00007.html cat >input.y <<'_ATEOF' %% expr: term | term | term | term | term | term term: 'n' _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:286: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:286" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:286: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:286" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:286: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:286" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:2.14-17: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.21-24: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.28-31: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.35-38: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.42-45: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:2.14-17: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.21-24: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.28-31: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.35-38: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ input.y:2.42-45: warning: rule useless in parser due to conflicts [-Wother] 2 | expr: term | term | term | term | term | term | ^~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/sets.at:286: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "sets.at:286" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:286: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "sets.at:286" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:286" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_172 #AT_START_173 at_fn_group_banner 173 'sets.at:315' \ "Reduced Grammar" " " 7 at_xfail=no ( printf "%s\n" "173. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% expr: expr "+" term | term term: term "*" fact | fact useless: "useless" fact: "num" _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --trace=grammar -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --trace=grammar -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=grammar -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=grammar -o input.c input.y" "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=grammar -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:325: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:325" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:325: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:325" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:325: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:325" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=grammar -o input.c input.y" at_fn_check_prepare_trace "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=grammar -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "bison (GNU Bison) 3.8.2 input.y: warning: 1 nonterminal useless in grammar [-Wother] input.y: warning: 1 rule useless in grammar [-Wother] input.y:4.1-7: warning: nonterminal useless in grammar: useless [-Wother] Reduced Grammar ntokens = 7, nnterms = 4, nsyms = 11, nrules = 6, nritems = 17 Tokens ------ Value Sprec Sassoc Tag 0 0 0 \$end 1 0 0 error 2 0 0 \$undefined 3 0 0 \"+\" 4 0 0 \"*\" 5 0 0 \"useless\" 6 0 0 \"num\" Nonterminals ------------ Value Tag 7 \$accept 8 expr 9 term 10 fact Rules ----- Num (Prec, Assoc, Useful, UselessChain) Lhs -> (Ritem Range) Rhs 0 ( 0, 0, t, f) 7 -> ( 0- 1) 8 0 1 ( 0, 0, t, f) 8 -> ( 3- 5) 8 3 9 2 ( 0, 0, t, t) 8 -> ( 7- 7) 9 3 ( 0, 0, t, f) 9 -> ( 9-11) 9 4 10 4 ( 0, 0, t, t) 9 -> (13-13) 10 5 ( 0, 0, t, t) 10 -> (17-17) 6 6 ( 0, 0, f, t) 11 -> (15-15) 5 Rules interpreted ----------------- 0 \$accept: expr \$end 1 expr: expr \"+\" term 2 expr: term 3 term: term \"*\" fact 4 term: fact 5 fact: \"num\" 6 useless: \"useless\" reduced input.y defines 7 terminals, 4 nonterminals, and 6 productions. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y -Werror" "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' bison (GNU Bison) 3.8.2 input.y: warning: 1 nonterminal useless in grammar [-Wother] input.y: warning: 1 rule useless in grammar [-Wother] input.y:4.1-7: warning: nonterminal useless in grammar: useless [-Wother] Reduced Grammar ntokens = 7, nnterms = 4, nsyms = 11, nrules = 6, nritems = 17 Tokens ------ Value Sprec Sassoc Tag 0 0 0 $end 1 0 0 error 2 0 0 $undefined 3 0 0 "+" 4 0 0 "*" 5 0 0 "useless" 6 0 0 "num" Nonterminals ------------ Value Tag 7 $accept 8 expr 9 term 10 fact Rules ----- Num (Prec, Assoc, Useful, UselessChain) Lhs -> (Ritem Range) Rhs 0 ( 0, 0, t, f) 7 -> ( 0- 1) 8 0 1 ( 0, 0, t, f) 8 -> ( 3- 5) 8 3 9 2 ( 0, 0, t, t) 8 -> ( 7- 7) 9 3 ( 0, 0, t, f) 9 -> ( 9-11) 9 4 10 4 ( 0, 0, t, t) 9 -> (13-13) 10 5 ( 0, 0, t, t) 10 -> (17-17) 6 6 ( 0, 0, f, t) 11 -> (15-15) 5 Rules interpreted ----------------- 0 $accept: expr $end 1 expr: expr "+" term 2 expr: term 3 term: term "*" fact 4 term: fact 5 fact: "num" 6 useless: "useless" reduced input.y defines 7 terminals, 4 nonterminals, and 6 productions. _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/sets.at:325: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "sets.at:325" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y --warnings=error" "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y -Wnone,none -Werror --trace=none" "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y --warnings=none -Werror --trace=none" "sets.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=grammar -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:325" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_173 #AT_START_174 at_fn_group_banner 174 'sets.at:394' \ "Reduced Grammar with prec and assoc" " " 7 at_xfail=no ( printf "%s\n" "174. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %nonassoc '<' '>' %left '+' '-' %right '^' '=' %% exp: exp '<' exp | exp '>' exp | exp '+' exp | exp '-' exp | exp '^' exp | exp '=' exp | "exp" ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/sets.at:412: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --trace=grammar -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "sets.at:412" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --trace=grammar -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:412" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/sets.at:412: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=grammar -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=grammar -o input.c input.y" "sets.at:412" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=grammar -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:412" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/sets.at:412: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:412" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:412" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/sets.at:412: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "sets.at:412" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:412" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/sets.at:412: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "sets.at:412" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/sets.at:412" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/sets.at:412: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=grammar -o input.c input.y" at_fn_check_prepare_trace "sets.at:412" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=grammar -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "bison (GNU Bison) 3.8.2 Reduced Grammar ntokens = 10, nnterms = 2, nsyms = 12, nrules = 8, nritems = 29 Tokens ------ Value Sprec Sassoc Tag 0 0 0 \$end 1 0 0 error 2 0 0 \$undefined 3 1 3 '<' 4 1 3 '>' 5 2 2 '+' 6 2 2 '-' 7 3 1 '^' 8 3 1 '=' 9 0 0 \"exp\" Nonterminals ------------ Value Tag 10 \$accept 11 exp Rules ----- Num (Prec, Assoc, Useful, UselessChain) Lhs -> (Ritem Range) Rhs 0 ( 0, 0, t, f) 10 -> ( 0- 1) 11 0 1 ( 1, 3, t, f) 11 -> ( 3- 5) 11 3 11 2 ( 1, 3, t, f) 11 -> ( 7- 9) 11 4 11 3 ( 2, 2, t, f) 11 -> (11-13) 11 5 11 4 ( 2, 2, t, f) 11 -> (15-17) 11 6 11 5 ( 3, 1, t, f) 11 -> (19-21) 11 7 11 6 ( 3, 1, t, f) 11 -> (23-25) 11 8 11 7 ( 0, 0, t, t) 11 -> (27-27) 9 Rules interpreted ----------------- 0 \$accept: exp \$end 1 exp: exp '<' exp 2 exp: exp '>' exp 3 exp: exp '+' exp 4 exp: exp '-' exp 5 exp: exp '^' exp 6 exp: exp '=' exp 7 exp: \"exp\" reduced input.y defines 10 terminals, 2 nonterminals, and 8 productions. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/sets.at:412" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_174 #AT_START_175 at_fn_group_banner 175 'reduce.at:26' \ "Useless Terminals" " " 8 at_xfail=no ( printf "%s\n" "175. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %verbose %output "input.c" %token useless1 %token useless2 %token useless3 %token useless4 %token useless5 %token useless6 %token useless7 %token useless8 %token useless9 %token useful %% exp: useful; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:47: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:47" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:47" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:47: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "reduce.at:47" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:47" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:47: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:47" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:47" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:47: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:47" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:47" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:47: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:47" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:47" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:47: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "reduce.at:47" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:47" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:49: sed -n '/^Grammar/q;/^\$/!p' input.output" at_fn_check_prepare_dynamic "sed -n '/^Grammar/q;/^$/!p' input.output" "reduce.at:49" ( $at_check_trace; sed -n '/^Grammar/q;/^$/!p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Terminals unused in grammar useless1 useless2 useless3 useless4 useless5 useless6 useless7 useless8 useless9 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:49" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_175 #AT_START_176 at_fn_group_banner 176 'reduce.at:70' \ "Useless Nonterminals" " " 8 at_xfail=no ( printf "%s\n" "176. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code { void yyerror (const char *msg); int yylex (void); } %verbose %output "input.c" %token useful %% exp: useful; useless1: useless2: useless3: _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y" "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:89: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:89" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:89: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:89" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:89: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:89" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y" at_fn_check_prepare_trace "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 3 nonterminals useless in grammar [-Wother] input.y: warning: 3 rules useless in grammar [-Wother] input.y:11.1-8: warning: nonterminal useless in grammar: useless1 [-Wother] input.y:12.1-8: warning: nonterminal useless in grammar: useless2 [-Wother] input.y:13.1-8: warning: nonterminal useless in grammar: useless3 [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror" "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 3 nonterminals useless in grammar [-Wother] input.y: warning: 3 rules useless in grammar [-Wother] input.y:11.1-8: warning: nonterminal useless in grammar: useless1 [-Wother] input.y:12.1-8: warning: nonterminal useless in grammar: useless2 [-Wother] input.y:13.1-8: warning: nonterminal useless in grammar: useless3 [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:89: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:89" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error" "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none" "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:89: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none" "reduce.at:89" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:89" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:97: sed -n '/^Grammar/q;/^\$/!p' input.output" at_fn_check_prepare_dynamic "sed -n '/^Grammar/q;/^$/!p' input.output" "reduce.at:97" ( $at_check_trace; sed -n '/^Grammar/q;/^$/!p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Nonterminals useless in grammar useless1 useless2 useless3 Rules useless in grammar 2 useless1: %empty 3 useless2: %empty 4 useless3: %empty " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:97" $at_failed && at_fn_log_failure $at_traceon; } # Make sure the generated parser is correct. printf "%s\n" "reduce.at:109" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:109" { set +x printf "%s\n" "$at_srcdir/reduce.at:109: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "reduce.at:109" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:109" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_176 #AT_START_177 at_fn_group_banner 177 'reduce.at:120' \ "Useless Rules" " " 8 at_xfail=no ( printf "%s\n" "177. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code { void yyerror (const char *msg); int yylex (void); } %verbose %output "input.c" %token useful %% exp: useful; useless1: '1'; useless2: '2'; useless3: '3'; useless4: '4'; useless5: '5'; useless6: '6'; useless7: '7'; useless8: '8'; useless9: '9'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:146: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:146" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:146: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:146" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:146: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:146" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 9 nonterminals useless in grammar [-Wother] input.y: warning: 9 rules useless in grammar [-Wother] input.y:10.1-8: warning: nonterminal useless in grammar: useless1 [-Wother] 10 | useless1: '1'; | ^~~~~~~~ input.y:11.1-8: warning: nonterminal useless in grammar: useless2 [-Wother] 11 | useless2: '2'; | ^~~~~~~~ input.y:12.1-8: warning: nonterminal useless in grammar: useless3 [-Wother] 12 | useless3: '3'; | ^~~~~~~~ input.y:13.1-8: warning: nonterminal useless in grammar: useless4 [-Wother] 13 | useless4: '4'; | ^~~~~~~~ input.y:14.1-8: warning: nonterminal useless in grammar: useless5 [-Wother] 14 | useless5: '5'; | ^~~~~~~~ input.y:15.1-8: warning: nonterminal useless in grammar: useless6 [-Wother] 15 | useless6: '6'; | ^~~~~~~~ input.y:16.1-8: warning: nonterminal useless in grammar: useless7 [-Wother] 16 | useless7: '7'; | ^~~~~~~~ input.y:17.1-8: warning: nonterminal useless in grammar: useless8 [-Wother] 17 | useless8: '8'; | ^~~~~~~~ input.y:18.1-8: warning: nonterminal useless in grammar: useless9 [-Wother] 18 | useless9: '9'; | ^~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 9 nonterminals useless in grammar [-Wother] input.y: warning: 9 rules useless in grammar [-Wother] input.y:10.1-8: warning: nonterminal useless in grammar: useless1 [-Wother] 10 | useless1: '1'; | ^~~~~~~~ input.y:11.1-8: warning: nonterminal useless in grammar: useless2 [-Wother] 11 | useless2: '2'; | ^~~~~~~~ input.y:12.1-8: warning: nonterminal useless in grammar: useless3 [-Wother] 12 | useless3: '3'; | ^~~~~~~~ input.y:13.1-8: warning: nonterminal useless in grammar: useless4 [-Wother] 13 | useless4: '4'; | ^~~~~~~~ input.y:14.1-8: warning: nonterminal useless in grammar: useless5 [-Wother] 14 | useless5: '5'; | ^~~~~~~~ input.y:15.1-8: warning: nonterminal useless in grammar: useless6 [-Wother] 15 | useless6: '6'; | ^~~~~~~~ input.y:16.1-8: warning: nonterminal useless in grammar: useless7 [-Wother] 16 | useless7: '7'; | ^~~~~~~~ input.y:17.1-8: warning: nonterminal useless in grammar: useless8 [-Wother] 17 | useless8: '8'; | ^~~~~~~~ input.y:18.1-8: warning: nonterminal useless in grammar: useless9 [-Wother] 18 | useless9: '9'; | ^~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:146: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:146" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "reduce.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:146" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:179: sed -n '/^Grammar/q;/^\$/!p' input.output" at_fn_check_prepare_dynamic "sed -n '/^Grammar/q;/^$/!p' input.output" "reduce.at:179" ( $at_check_trace; sed -n '/^Grammar/q;/^$/!p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Nonterminals useless in grammar useless1 useless2 useless3 useless4 useless5 useless6 useless7 useless8 useless9 Terminals unused in grammar '1' '2' '3' '4' '5' '6' '7' '8' '9' Rules useless in grammar 2 useless1: '1' 3 useless2: '2' 4 useless3: '3' 5 useless4: '4' 6 useless5: '5' 7 useless6: '6' 8 useless7: '7' 9 useless8: '8' 10 useless9: '9' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:179" $at_failed && at_fn_log_failure $at_traceon; } # Make sure the generated parser is correct. printf "%s\n" "reduce.at:213" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:213" { set +x printf "%s\n" "$at_srcdir/reduce.at:213: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "reduce.at:213" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:213" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_177 #AT_START_178 at_fn_group_banner 178 'reduce.at:224' \ "Useless Parts" " " 8 at_xfail=no ( printf "%s\n" "178. $at_setup_line: testing $at_desc ..." $at_traceon # We used to emit code that used symbol numbers before the useless # symbol elimination, hence before the renumbering of the useful # symbols. As a result, the evaluation of the skeleton failed because # it used non existing symbol numbers. Which is the happy scenario: # we could use numbers of other existing symbols... # https://lists.gnu.org/r/bug-bison/2019-01/msg00044.html cat >input.y <<'_ATEOF' %code { void yyerror (const char *msg); int yylex (void); } %union { void* ptr; } %type used1 %type used2 %% start : used1 ; used1 : used2 { $$ = $1; } ; unused : used2 ; used2 : { $$ = YY_NULLPTR; } ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -rall -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -rall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -rall -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -rall -o input.c input.y" "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -rall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:261: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:261" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:261: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:261" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:261: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:261" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y" at_fn_check_prepare_trace "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 nonterminal useless in grammar [-Wother] input.y: warning: 1 rule useless in grammar [-Wother] input.y:18.1-6: warning: nonterminal useless in grammar: unused [-Wother] 18 | unused | ^~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y -Werror" "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 nonterminal useless in grammar [-Wother] input.y: warning: 1 rule useless in grammar [-Wother] input.y:18.1-6: warning: nonterminal useless in grammar: unused [-Wother] 18 | unused | ^~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:261: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:261" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y --warnings=error" "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y -Wnone,none -Werror --trace=none" "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y --warnings=none -Werror --trace=none" "reduce.at:261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -rall -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:261" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:270: sed -n '/^State 0/q;/^\$/!p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0/q;/^$/!p' input.output" "reduce.at:270" ( $at_check_trace; sed -n '/^State 0/q;/^$/!p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Nonterminals useless in grammar unused Rules useless in grammar 4 unused: used2 Grammar 0 \$accept: start \$end 1 start: used1 2 used1: used2 3 used2: %empty Terminals, with rules where they appear \$end (0) 0 error (256) Nonterminals, with rules where they appear \$accept (3) on left: 0 start (4) on left: 1 on right: 0 used1 (5) on left: 2 on right: 1 used2 (6) on left: 3 on right: 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:270" $at_failed && at_fn_log_failure $at_traceon; } # Make sure the generated parser is correct. printf "%s\n" "reduce.at:298" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:298" { set +x printf "%s\n" "$at_srcdir/reduce.at:298: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "reduce.at:298" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:298" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_178 #AT_START_179 at_fn_group_banner 179 'reduce.at:312' \ "Reduced Automaton" " " 8 at_xfail=no ( printf "%s\n" "179. $at_setup_line: testing $at_desc ..." $at_traceon # The non reduced grammar. # ------------------------ cat >not-reduced.y <<'_ATEOF' /* A useless token. */ %token useless_token /* A useful one. */ %token useful %verbose %output "not-reduced.c" %% exp: useful { /* A useful action. */ } | non_productive { /* A non productive action. */ } ; not_reachable: useful { /* A not reachable action. */ } ; non_productive: non_productive useless_token { /* Another non productive action. */ } ; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret not-reduced.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret not-reduced.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret not-reduced.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret not-reduced.y" "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret not-reduced.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:341: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:341" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret not-reduced.y" at_fn_check_prepare_trace "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret not-reduced.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother] not-reduced.y: warning: 3 rules useless in grammar [-Wother] not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother] 14 | not_reachable: useful { /* A not reachable action. */ } | ^~~~~~~~~~~~~ not-reduced.y:17.1-14: warning: nonterminal useless in grammar: non_productive [-Wother] 17 | non_productive: non_productive useless_token | ^~~~~~~~~~~~~~ not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother] 11 | | non_productive { /* A non productive action. */ } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y -Werror" "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother] not-reduced.y: warning: 3 rules useless in grammar [-Wother] not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother] 14 | not_reachable: useful { /* A not reachable action. */ } | ^~~~~~~~~~~~~ not-reduced.y:17.1-14: warning: nonterminal useless in grammar: non_productive [-Wother] 17 | non_productive: non_productive useless_token | ^~~~~~~~~~~~~~ not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother] 11 | | non_productive { /* A non productive action. */ } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:341: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:341" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y --warnings=error" "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y -Wnone,none -Werror --trace=none" "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y --warnings=none -Werror --trace=none" "reduce.at:341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret not-reduced.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:341" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:355: sed -n '/^Grammar/q;/^\$/!p' not-reduced.output" at_fn_check_prepare_dynamic "sed -n '/^Grammar/q;/^$/!p' not-reduced.output" "reduce.at:355" ( $at_check_trace; sed -n '/^Grammar/q;/^$/!p' not-reduced.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Nonterminals useless in grammar not_reachable non_productive Terminals unused in grammar useless_token Rules useless in grammar 2 exp: non_productive 3 not_reachable: useful 4 non_productive: non_productive useless_token " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:355" $at_failed && at_fn_log_failure $at_traceon; } # The reduced grammar. # -------------------- cat >reduced.y <<'_ATEOF' /* A useless token. */ %token useless_token /* A useful one. */ %token useful %verbose %output "reduced.c" %% exp: useful { /* A useful action. */ } // | non_productive { /* A non productive action. */ } */ ; //not_reachable: useful { /* A not reachable action. */ } // ; //non_productive: non_productive useless_token // { /* Another non productive action. */ } // ; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:392: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv reduced.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:392" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv reduced.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:392: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml reduced.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml reduced.y" "reduce.at:392" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml reduced.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:392" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:392: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:392" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:392" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:392: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:392" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:392" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:392: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:392" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:392" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:392: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret reduced.y" at_fn_check_prepare_trace "reduce.at:392" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret reduced.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:392" $at_failed && at_fn_log_failure $at_traceon; } # Comparing the parsers. cp reduced.c expout { set +x printf "%s\n" "$at_srcdir/reduce.at:396: sed 's/not-reduced/reduced/g' not-reduced.c" at_fn_check_prepare_trace "reduce.at:396" ( $at_check_trace; sed 's/not-reduced/reduced/g' not-reduced.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:396" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_179 #AT_START_180 at_fn_group_banner 180 'reduce.at:406' \ "Underivable Rules" " " 8 at_xfail=no ( printf "%s\n" "180. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %verbose %output "input.c" %token useful %% exp: useful | underivable; underivable: indirection; indirection: underivable; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y" "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:420: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:420" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:420: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:420" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:420: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:420" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y" at_fn_check_prepare_trace "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 2 nonterminals useless in grammar [-Wother] input.y: warning: 3 rules useless in grammar [-Wother] input.y:6.1-11: warning: nonterminal useless in grammar: underivable [-Wother] 6 | underivable: indirection; | ^~~~~~~~~~~ input.y:7.1-11: warning: nonterminal useless in grammar: indirection [-Wother] 7 | indirection: underivable; | ^~~~~~~~~~~ input.y:5.15-25: warning: rule useless in grammar [-Wother] 5 | exp: useful | underivable; | ^~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror" "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 2 nonterminals useless in grammar [-Wother] input.y: warning: 3 rules useless in grammar [-Wother] input.y:6.1-11: warning: nonterminal useless in grammar: underivable [-Wother] 6 | underivable: indirection; | ^~~~~~~~~~~ input.y:7.1-11: warning: nonterminal useless in grammar: indirection [-Wother] 7 | indirection: underivable; | ^~~~~~~~~~~ input.y:5.15-25: warning: rule useless in grammar [-Wother] 5 | exp: useful | underivable; | ^~~~~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:420: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:420" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error" "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none" "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:420: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none" "reduce.at:420" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:420" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:434: sed -n '/^Grammar/q;/^\$/!p' input.output" at_fn_check_prepare_dynamic "sed -n '/^Grammar/q;/^$/!p' input.output" "reduce.at:434" ( $at_check_trace; sed -n '/^Grammar/q;/^$/!p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Nonterminals useless in grammar underivable indirection Rules useless in grammar 2 exp: underivable 3 underivable: indirection 4 indirection: underivable " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:434" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_180 #AT_START_181 at_fn_group_banner 181 'reduce.at:452' \ "Bad start symbols" " " 8 at_xfail=no ( printf "%s\n" "181. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: exp; _ATEOF { set +x printf "%s\n" "$at_srcdir/reduce.at:467: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "reduce.at:467" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 2 nonterminals useless in grammar [-Wother] input.y: warning: 2 rules useless in grammar [-Wother] input.y:2.1-3: error: start symbol exp does not derive any sentence " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:467" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% %start exp; exp: exp; _ATEOF { set +x printf "%s\n" "$at_srcdir/reduce.at:473: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "reduce.at:473" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 2 nonterminals useless in grammar [-Wother] input.y: warning: 2 rules useless in grammar [-Wother] input.y:2.8-10: error: start symbol exp does not derive any sentence " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:473" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% %start exp stmt; exp: exp; stmt: "stmt" _ATEOF { set +x printf "%s\n" "$at_srcdir/reduce.at:480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "reduce.at:480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 nonterminal useless in grammar [-Wother] input.y: warning: 2 rules useless in grammar [-Wother] input.y:2.8-10: error: start symbol exp does not derive any sentence " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:480" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% %start exp stmt; exp: exp; stmt: stmt _ATEOF { set +x printf "%s\n" "$at_srcdir/reduce.at:488: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "reduce.at:488" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 3 nonterminals useless in grammar [-Wother] input.y: warning: 4 rules useless in grammar [-Wother] input.y:2.8-10: error: start symbol exp does not derive any sentence input.y:2.12-15: error: start symbol stmt does not derive any sentence " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:488" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% %start exp; stmt: stmt _ATEOF { set +x printf "%s\n" "$at_srcdir/reduce.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "reduce.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-10: warning: symbol 'exp' is used, but is not defined as a token and has no rules [-Wother] input.y: warning: 3 nonterminals useless in grammar [-Wother] input.y: warning: 2 rules useless in grammar [-Wother] input.y:2.8-10: error: start symbol exp does not derive any sentence " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:497" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %% %token FOO; %start FOO; stmt: FOO _ATEOF { set +x printf "%s\n" "$at_srcdir/reduce.at:505: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "reduce.at:505" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-10: error: the start symbol FOO is a token " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:505" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_181 #AT_START_182 at_fn_group_banner 182 'reduce.at:550' \ "no lr.type: Single State Split" " " 8 at_xfail=no ( printf "%s\n" "182. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %left 'a' // Conflict resolution renders state 12 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; /* A conflict should appear after the first 'a' in rules 4 and 5 but only after having shifted the first 'a' in rule 1. However, when LALR(1) merging is chosen, the state containing that conflict is reused after having seen the first 'b' in rule 2 and then the first 'a' in rules 4 and 5. In both cases, because of the merged state, if the next token is an 'a', the %left forces a reduction action with rule 5. In the latter case, only a shift is actually grammatically correct. Thus, the parser would report a syntax error for the grammatically correct sentence "baab" because it would encounter a syntax error after that incorrect reduction. Despite not being LALR(1), Menhir version 20070322 suffers from this problem as well. It uses David Pager's weak compatibility test for merging states. Bison and Menhir accept non-LR(1) grammars with conflict resolution. Pager designed his algorithm only for LR(1) grammars. */ A: 'a' 'a' /* rule 4 */ | 'a' /* rule 5 */ ; /* Rule 3, rule 6, and rule 7 ensure that Bison does not report rule 4 as useless after conflict resolution. This proves that, even though LALR(1) generates incorrect parser tables sometimes, Bison will not necessarily produce any warning to help the user realize it. */ c: 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:550" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 5 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 5 | . 'a' 6 c: . 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 5 | 'a' . ['a', 'b'] \$default reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 5 | 'a' . [\$end] 6 c: 'a' . 'b' 'a' shift, and go to state 12 'b' shift, and go to state 15 \$default reduce using rule 5 (A) State 9 7 c: A . \$default reduce using rule 7 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . \$default reduce using rule 4 (A) State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 6 c: 'a' 'b' . \$default reduce using rule 6 (c) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:550" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:550" { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:550" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:550" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_182 #AT_START_183 at_fn_group_banner 183 'reduce.at:550' \ "lr.type=lalr: Single State Split" " " 8 at_xfail=no ( printf "%s\n" "183. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %left 'a' // Conflict resolution renders state 12 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; /* A conflict should appear after the first 'a' in rules 4 and 5 but only after having shifted the first 'a' in rule 1. However, when LALR(1) merging is chosen, the state containing that conflict is reused after having seen the first 'b' in rule 2 and then the first 'a' in rules 4 and 5. In both cases, because of the merged state, if the next token is an 'a', the %left forces a reduction action with rule 5. In the latter case, only a shift is actually grammatically correct. Thus, the parser would report a syntax error for the grammatically correct sentence "baab" because it would encounter a syntax error after that incorrect reduction. Despite not being LALR(1), Menhir version 20070322 suffers from this problem as well. It uses David Pager's weak compatibility test for merging states. Bison and Menhir accept non-LR(1) grammars with conflict resolution. Pager designed his algorithm only for LR(1) grammars. */ A: 'a' 'a' /* rule 4 */ | 'a' /* rule 5 */ ; /* Rule 3, rule 6, and rule 7 ensure that Bison does not report rule 4 as useless after conflict resolution. This proves that, even though LALR(1) generates incorrect parser tables sometimes, Bison will not necessarily produce any warning to help the user realize it. */ c: 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:550" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 5 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 5 | . 'a' 6 c: . 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 5 | 'a' . ['a', 'b'] \$default reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 5 | 'a' . [\$end] 6 c: 'a' . 'b' 'a' shift, and go to state 12 'b' shift, and go to state 15 \$default reduce using rule 5 (A) State 9 7 c: A . \$default reduce using rule 7 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . \$default reduce using rule 4 (A) State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 6 c: 'a' 'b' . \$default reduce using rule 6 (c) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:550" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:550" { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:550" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:550" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_183 #AT_START_184 at_fn_group_banner 184 'reduce.at:550' \ "lr.type=ielr: Single State Split" " " 8 at_xfail=no ( printf "%s\n" "184. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %left 'a' // Conflict resolution renders state 12 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; /* A conflict should appear after the first 'a' in rules 4 and 5 but only after having shifted the first 'a' in rule 1. However, when LALR(1) merging is chosen, the state containing that conflict is reused after having seen the first 'b' in rule 2 and then the first 'a' in rules 4 and 5. In both cases, because of the merged state, if the next token is an 'a', the %left forces a reduction action with rule 5. In the latter case, only a shift is actually grammatically correct. Thus, the parser would report a syntax error for the grammatically correct sentence "baab" because it would encounter a syntax error after that incorrect reduction. Despite not being LALR(1), Menhir version 20070322 suffers from this problem as well. It uses David Pager's weak compatibility test for merging states. Bison and Menhir accept non-LR(1) grammars with conflict resolution. Pager designed his algorithm only for LR(1) grammars. */ A: 'a' 'a' /* rule 4 */ | 'a' /* rule 5 */ ; /* Rule 3, rule 6, and rule 7 ensure that Bison does not report rule 4 as useless after conflict resolution. This proves that, even though LALR(1) generates incorrect parser tables sometimes, Bison will not necessarily produce any warning to help the user realize it. */ c: 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:550" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 16 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 5 | . 'a' 6 c: . 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 5 | 'a' . ['a'] \$default reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 5 | 'a' . [\$end] 6 c: 'a' . 'b' 'a' shift, and go to state 12 'b' shift, and go to state 15 \$default reduce using rule 5 (A) State 9 7 c: A . \$default reduce using rule 7 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . \$default reduce using rule 4 (A) State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 6 c: 'a' 'b' . \$default reduce using rule 6 (c) State 16 4 A: 'a' . 'a' 5 | 'a' . ['b'] 'a' shift, and go to state 12 \$default reduce using rule 5 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:550" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:550" { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:550" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:550" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_184 #AT_START_185 at_fn_group_banner 185 'reduce.at:550' \ "lr.type=canonical-lr: Single State Split" " " 8 at_xfail=no ( printf "%s\n" "185. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %left 'a' // Conflict resolution renders state 12 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; /* A conflict should appear after the first 'a' in rules 4 and 5 but only after having shifted the first 'a' in rule 1. However, when LALR(1) merging is chosen, the state containing that conflict is reused after having seen the first 'b' in rule 2 and then the first 'a' in rules 4 and 5. In both cases, because of the merged state, if the next token is an 'a', the %left forces a reduction action with rule 5. In the latter case, only a shift is actually grammatically correct. Thus, the parser would report a syntax error for the grammatically correct sentence "baab" because it would encounter a syntax error after that incorrect reduction. Despite not being LALR(1), Menhir version 20070322 suffers from this problem as well. It uses David Pager's weak compatibility test for merging states. Bison and Menhir accept non-LR(1) grammars with conflict resolution. Pager designed his algorithm only for LR(1) grammars. */ A: 'a' 'a' /* rule 4 */ | 'a' /* rule 5 */ ; /* Rule 3, rule 6, and rule 7 ensure that Bison does not report rule 4 as useless after conflict resolution. This proves that, even though LALR(1) generates incorrect parser tables sometimes, Bison will not necessarily produce any warning to help the user realize it. */ c: 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:550" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 5 | . 'a' 'a' shift, and go to state 16 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 5 | . 'a' 6 c: . 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 5 | 'a' . ['a'] 'a' reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 5 | 'a' . [\$end] 6 c: 'a' . 'b' 'a' shift, and go to state 17 'b' shift, and go to state 15 \$end reduce using rule 5 (A) State 9 7 c: A . [\$end] \$end reduce using rule 7 (c) State 10 3 S: 'c' c . [\$end] \$end reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . ['a'] 'a' reduce using rule 4 (A) State 13 1 S: 'a' A 'a' . [\$end] \$end reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . [\$end] \$end reduce using rule 2 (S) State 15 6 c: 'a' 'b' . [\$end] \$end reduce using rule 6 (c) State 16 4 A: 'a' . 'a' 5 | 'a' . ['b'] 'a' shift, and go to state 18 'b' reduce using rule 5 (A) State 17 4 A: 'a' 'a' . [\$end] \$end reduce using rule 4 (A) State 18 4 A: 'a' 'a' . ['b'] 'b' reduce using rule 4 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "reduce.at:550" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:550" { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:550" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:550" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:550: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:550" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:550" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_185 #AT_START_186 at_fn_group_banner 186 'reduce.at:783' \ "no lr.type: Lane Split" " " 8 at_xfail=no ( printf "%s\n" "186. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but two states must be split. */ S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; A: 'a' 'a' 'a' /* rule 4 */ | 'a' 'a' /* rule 5 */ ; c: 'a' 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:783" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 5 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 6 c: . 'a' 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 6 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 7 c: A . \$default reduce using rule 7 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['a', 'b'] \$default reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . [\$end] 6 c: 'a' 'a' . 'b' 'a' shift, and go to state 16 'b' shift, and go to state 17 \$default reduce using rule 5 (A) State 16 4 A: 'a' 'a' 'a' . \$default reduce using rule 4 (A) State 17 6 c: 'a' 'a' 'b' . \$default reduce using rule 6 (c) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:783" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:783" { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:783" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:783" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_186 #AT_START_187 at_fn_group_banner 187 'reduce.at:783' \ "lr.type=lalr: Lane Split" " " 8 at_xfail=no ( printf "%s\n" "187. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but two states must be split. */ S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; A: 'a' 'a' 'a' /* rule 4 */ | 'a' 'a' /* rule 5 */ ; c: 'a' 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:783" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 5 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 6 c: . 'a' 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 6 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 7 c: A . \$default reduce using rule 7 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['a', 'b'] \$default reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . [\$end] 6 c: 'a' 'a' . 'b' 'a' shift, and go to state 16 'b' shift, and go to state 17 \$default reduce using rule 5 (A) State 16 4 A: 'a' 'a' 'a' . \$default reduce using rule 4 (A) State 17 6 c: 'a' 'a' 'b' . \$default reduce using rule 6 (c) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:783" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:783" { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:783" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:783" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_187 #AT_START_188 at_fn_group_banner 188 'reduce.at:783' \ "lr.type=ielr: Lane Split" " " 8 at_xfail=no ( printf "%s\n" "188. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but two states must be split. */ S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; A: 'a' 'a' 'a' /* rule 4 */ | 'a' 'a' /* rule 5 */ ; c: 'a' 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:783" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 18 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 6 c: . 'a' 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 6 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 7 c: A . \$default reduce using rule 7 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['a'] \$default reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . [\$end] 6 c: 'a' 'a' . 'b' 'a' shift, and go to state 16 'b' shift, and go to state 17 \$default reduce using rule 5 (A) State 16 4 A: 'a' 'a' 'a' . \$default reduce using rule 4 (A) State 17 6 c: 'a' 'a' 'b' . \$default reduce using rule 6 (c) State 18 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 'a' shift, and go to state 19 State 19 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['b'] 'a' shift, and go to state 16 \$default reduce using rule 5 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:783" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:783" { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:783" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:783" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_188 #AT_START_189 at_fn_group_banner 189 'reduce.at:783' \ "lr.type=canonical-lr: Lane Split" " " 8 at_xfail=no ( printf "%s\n" "189. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but two states must be split. */ S: 'a' A 'a' /* rule 1 */ | 'b' A 'b' /* rule 2 */ | 'c' c /* rule 3 */ ; A: 'a' 'a' 'a' /* rule 4 */ | 'a' 'a' /* rule 5 */ ; c: 'a' 'a' 'b' /* rule 6 */ | A /* rule 7 */ ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:783" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:783: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:783" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 'a' shift, and go to state 18 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' 'a' 5 | . 'a' 'a' 6 c: . 'a' 'a' 'b' 7 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 6 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 7 c: A . [\$end] \$end reduce using rule 7 (c) State 10 3 S: 'c' c . [\$end] \$end reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['a'] 'a' reduce using rule 5 (A) Conflict between rule 5 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . [\$end] \$end reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . [\$end] \$end reduce using rule 2 (S) State 15 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . [\$end] 6 c: 'a' 'a' . 'b' 'a' shift, and go to state 19 'b' shift, and go to state 17 \$end reduce using rule 5 (A) State 16 4 A: 'a' 'a' 'a' . ['a'] 'a' reduce using rule 4 (A) State 17 6 c: 'a' 'a' 'b' . [\$end] \$end reduce using rule 6 (c) State 18 4 A: 'a' . 'a' 'a' 5 | 'a' . 'a' 'a' shift, and go to state 20 State 19 4 A: 'a' 'a' 'a' . [\$end] \$end reduce using rule 4 (A) State 20 4 A: 'a' 'a' . 'a' 5 | 'a' 'a' . ['b'] 'a' shift, and go to state 21 'b' reduce using rule 5 (A) State 21 4 A: 'a' 'a' 'a' . ['b'] 'b' reduce using rule 4 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "reduce.at:783" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:783" { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:783" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:783" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:783: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:783" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:783" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_189 #AT_START_190 at_fn_group_banner 190 'reduce.at:1027' \ "no lr.type: Complex Lane Split" " " 8 at_xfail=no ( printf "%s\n" "190. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but forseeing the S/R conflict from the first state that must be split is becoming difficult. Imagine if B were even more complex. Imagine if A had other RHS's ending in other nonterminals. */ S: 'a' A 'a' | 'b' A 'b' | 'c' c ; A: 'a' 'a' B ; B: 'a' | %empty %prec 'a' ; c: 'a' 'a' 'b' | A ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1027" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' B 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' B 'a' shift, and go to state 5 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' B 7 c: . 'a' 'a' 'b' 8 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' B 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' B 7 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 8 c: A . \$default reduce using rule 8 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . ['a', 'b'] \$default reduce using rule 6 (B) B go to state 17 Conflict between rule 6 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . [\$end] 7 c: 'a' 'a' . 'b' 'a' shift, and go to state 16 'b' shift, and go to state 18 \$default reduce using rule 6 (B) B go to state 17 State 16 5 B: 'a' . \$default reduce using rule 5 (B) State 17 4 A: 'a' 'a' B . \$default reduce using rule 4 (A) State 18 7 c: 'a' 'a' 'b' . \$default reduce using rule 7 (c) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1027" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1027" { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1027" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1027" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_190 #AT_START_191 at_fn_group_banner 191 'reduce.at:1027' \ "lr.type=lalr: Complex Lane Split" " " 8 at_xfail=no ( printf "%s\n" "191. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but forseeing the S/R conflict from the first state that must be split is becoming difficult. Imagine if B were even more complex. Imagine if A had other RHS's ending in other nonterminals. */ S: 'a' A 'a' | 'b' A 'b' | 'c' c ; A: 'a' 'a' B ; B: 'a' | %empty %prec 'a' ; c: 'a' 'a' 'b' | A ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1027" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' B 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' B 'a' shift, and go to state 5 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' B 7 c: . 'a' 'a' 'b' 8 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' B 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' B 7 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 8 c: A . \$default reduce using rule 8 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . ['a', 'b'] \$default reduce using rule 6 (B) B go to state 17 Conflict between rule 6 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . [\$end] 7 c: 'a' 'a' . 'b' 'a' shift, and go to state 16 'b' shift, and go to state 18 \$default reduce using rule 6 (B) B go to state 17 State 16 5 B: 'a' . \$default reduce using rule 5 (B) State 17 4 A: 'a' 'a' B . \$default reduce using rule 4 (A) State 18 7 c: 'a' 'a' 'b' . \$default reduce using rule 7 (c) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1027" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1027" { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1027" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1027" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_191 #AT_START_192 at_fn_group_banner 192 'reduce.at:1027' \ "lr.type=ielr: Complex Lane Split" " " 8 at_xfail=no ( printf "%s\n" "192. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but forseeing the S/R conflict from the first state that must be split is becoming difficult. Imagine if B were even more complex. Imagine if A had other RHS's ending in other nonterminals. */ S: 'a' A 'a' | 'b' A 'b' | 'c' c ; A: 'a' 'a' B ; B: 'a' | %empty %prec 'a' ; c: 'a' 'a' 'b' | A ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1027" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' B 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' B 'a' shift, and go to state 19 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' B 7 c: . 'a' 'a' 'b' 8 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' B 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' B 7 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 8 c: A . \$default reduce using rule 8 (c) State 10 3 S: 'c' c . \$default reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . ['a'] \$default reduce using rule 6 (B) B go to state 17 Conflict between rule 6 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . \$default reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . \$default reduce using rule 2 (S) State 15 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . [\$end] 7 c: 'a' 'a' . 'b' 'a' shift, and go to state 16 'b' shift, and go to state 18 \$default reduce using rule 6 (B) B go to state 17 State 16 5 B: 'a' . \$default reduce using rule 5 (B) State 17 4 A: 'a' 'a' B . \$default reduce using rule 4 (A) State 18 7 c: 'a' 'a' 'b' . \$default reduce using rule 7 (c) State 19 4 A: 'a' . 'a' B 'a' shift, and go to state 20 State 20 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . ['b'] 'a' shift, and go to state 16 \$default reduce using rule 6 (B) B go to state 17 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1027" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1027" { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1027" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1027" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_192 #AT_START_193 at_fn_group_banner 193 'reduce.at:1027' \ "lr.type=canonical-lr: Complex Lane Split" " " 8 at_xfail=no ( printf "%s\n" "193. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %left 'a' // Conflict resolution renders state 16 unreachable for canonical LR(1). We // keep it so that the parser table diff is easier to code. %define lr.keep-unreachable-state %% /* Similar to the last test case set but forseeing the S/R conflict from the first state that must be split is becoming difficult. Imagine if B were even more complex. Imagine if A had other RHS's ending in other nonterminals. */ S: 'a' A 'a' | 'b' A 'b' | 'c' c ; A: 'a' 'a' B ; B: 'a' | %empty %prec 'a' ; c: 'a' 'a' 'b' | A ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'a', 'a', 'a', 'b', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1027" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1027" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'a' 2 | . 'b' A 'b' 3 | . 'c' c 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'a' 4 A: . 'a' 'a' B 'a' shift, and go to state 5 A go to state 6 State 2 2 S: 'b' . A 'b' 4 A: . 'a' 'a' B 'a' shift, and go to state 19 A go to state 7 State 3 3 S: 'c' . c 4 A: . 'a' 'a' B 7 c: . 'a' 'a' 'b' 8 | . A 'a' shift, and go to state 8 A go to state 9 c go to state 10 State 4 0 \$accept: S . \$end \$end shift, and go to state 11 State 5 4 A: 'a' . 'a' B 'a' shift, and go to state 12 State 6 1 S: 'a' A . 'a' 'a' shift, and go to state 13 State 7 2 S: 'b' A . 'b' 'b' shift, and go to state 14 State 8 4 A: 'a' . 'a' B 7 c: 'a' . 'a' 'b' 'a' shift, and go to state 15 State 9 8 c: A . [\$end] \$end reduce using rule 8 (c) State 10 3 S: 'c' c . [\$end] \$end reduce using rule 3 (S) State 11 0 \$accept: S \$end . \$default accept State 12 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . ['a'] 'a' reduce using rule 6 (B) B go to state 17 Conflict between rule 6 and token 'a' resolved as reduce (%left 'a'). State 13 1 S: 'a' A 'a' . [\$end] \$end reduce using rule 1 (S) State 14 2 S: 'b' A 'b' . [\$end] \$end reduce using rule 2 (S) State 15 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . [\$end] 7 c: 'a' 'a' . 'b' 'a' shift, and go to state 20 'b' shift, and go to state 18 \$end reduce using rule 6 (B) B go to state 21 State 16 5 B: 'a' . ['a'] 'a' reduce using rule 5 (B) State 17 4 A: 'a' 'a' B . ['a'] 'a' reduce using rule 4 (A) State 18 7 c: 'a' 'a' 'b' . [\$end] \$end reduce using rule 7 (c) State 19 4 A: 'a' . 'a' B 'a' shift, and go to state 22 State 20 5 B: 'a' . [\$end] \$end reduce using rule 5 (B) State 21 4 A: 'a' 'a' B . [\$end] \$end reduce using rule 4 (A) State 22 4 A: 'a' 'a' . B 5 B: . 'a' 6 | %empty . ['b'] 'a' shift, and go to state 23 'b' reduce using rule 6 (B) B go to state 24 State 23 5 B: 'a' . ['b'] 'b' reduce using rule 5 (B) State 24 4 A: 'a' 'a' B . ['b'] 'b' reduce using rule 4 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "reduce.at:1027" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1027" { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1027" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1027" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1027: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1027" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1027" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_193 #AT_START_194 at_fn_group_banner 194 'reduce.at:1296' \ "no lr.type: Split During Added Lookahead Propagation" "" 8 at_xfail=no ( printf "%s\n" "194. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.keep-unreachable-state %% /* The partial state chart diagram below is for LALR(1). State 0 is the start state. States are iterated for successor construction in numerical order. Transitions are downwards. State 13 has a R/R conflict that cannot be predicted by Bison's LR(1) algorithm using annotations alone. That is, when state 11's successor on 'd' is merged with state 5 (which is originally just state 1's successor on 'd'), state 5's successor on 'e' must then be changed because the resulting lookaheads that propagate to it now make it incompatible with state 8's successor on 'e'. In other words, state 13 must be split to avoid the conflict. 0 / | \ a / c| \ b 1 3 2 | | | d| |c | d | 11 | | | | \ /d | 5 8 \ | e \ / e 13 R/R This grammar is designed carefully to make sure that, despite Bison's LR(1) algorithm's bread-first iteration of transitions to reconstruct states, state 11's successors are constructed after state 5's and state 8's. Otherwise (for example, if you remove the first 'c' in each of rules 6 and 7), state 5's successor on 'e' would never be merged with state 8's, so the split of the resulting state 13 would never need to be performed. */ S: 'a' A 'f' | 'a' B | 'b' A 'f' | 'b' B 'g' | 'b' 'd' | 'c' 'c' A 'g' | 'c' 'c' B ; A: 'd' 'e' ; B: 'd' 'e' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'd', 'e', 'g', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:1296" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1296" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'f' 2 | . 'a' B 3 | . 'b' A 'f' 4 | . 'b' B 'g' 5 | . 'b' 'd' 6 | . 'c' 'c' A 'g' 7 | . 'c' 'c' B 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'f' 2 | 'a' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 6 B go to state 7 State 2 3 S: 'b' . A 'f' 4 | 'b' . B 'g' 5 | 'b' . 'd' 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 8 A go to state 9 B go to state 10 State 3 6 S: 'c' . 'c' A 'g' 7 | 'c' . 'c' B 'c' shift, and go to state 11 State 4 0 \$accept: S . \$end \$end shift, and go to state 12 State 5 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 13 State 6 1 S: 'a' A . 'f' 'f' shift, and go to state 14 State 7 2 S: 'a' B . \$default reduce using rule 2 (S) State 8 5 S: 'b' 'd' . [\$end] 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 13 \$default reduce using rule 5 (S) State 9 3 S: 'b' A . 'f' 'f' shift, and go to state 15 State 10 4 S: 'b' B . 'g' 'g' shift, and go to state 16 State 11 6 S: 'c' 'c' . A 'g' 7 | 'c' 'c' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 17 B go to state 18 State 12 0 \$accept: S \$end . \$default accept State 13 8 A: 'd' 'e' . ['f', 'g'] 9 B: 'd' 'e' . [\$end, 'g'] \$end reduce using rule 9 (B) 'g' reduce using rule 8 (A) 'g' [reduce using rule 9 (B)] \$default reduce using rule 8 (A) State 14 1 S: 'a' A 'f' . \$default reduce using rule 1 (S) State 15 3 S: 'b' A 'f' . \$default reduce using rule 3 (S) State 16 4 S: 'b' B 'g' . \$default reduce using rule 4 (S) State 17 6 S: 'c' 'c' A . 'g' 'g' shift, and go to state 19 State 18 7 S: 'c' 'c' B . \$default reduce using rule 7 (S) State 19 6 S: 'c' 'c' A 'g' . \$default reduce using rule 6 (S) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1296" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1296" { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1296" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1296" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_194 #AT_START_195 at_fn_group_banner 195 'reduce.at:1296' \ "lr.type=lalr: Split During Added Lookahead Propagation" "" 8 at_xfail=no ( printf "%s\n" "195. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %define lr.keep-unreachable-state %% /* The partial state chart diagram below is for LALR(1). State 0 is the start state. States are iterated for successor construction in numerical order. Transitions are downwards. State 13 has a R/R conflict that cannot be predicted by Bison's LR(1) algorithm using annotations alone. That is, when state 11's successor on 'd' is merged with state 5 (which is originally just state 1's successor on 'd'), state 5's successor on 'e' must then be changed because the resulting lookaheads that propagate to it now make it incompatible with state 8's successor on 'e'. In other words, state 13 must be split to avoid the conflict. 0 / | \ a / c| \ b 1 3 2 | | | d| |c | d | 11 | | | | \ /d | 5 8 \ | e \ / e 13 R/R This grammar is designed carefully to make sure that, despite Bison's LR(1) algorithm's bread-first iteration of transitions to reconstruct states, state 11's successors are constructed after state 5's and state 8's. Otherwise (for example, if you remove the first 'c' in each of rules 6 and 7), state 5's successor on 'e' would never be merged with state 8's, so the split of the resulting state 13 would never need to be performed. */ S: 'a' A 'f' | 'a' B | 'b' A 'f' | 'b' B 'g' | 'b' 'd' | 'c' 'c' A 'g' | 'c' 'c' B ; A: 'd' 'e' ; B: 'd' 'e' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'd', 'e', 'g', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "reduce.at:1296" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1296" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'f' 2 | . 'a' B 3 | . 'b' A 'f' 4 | . 'b' B 'g' 5 | . 'b' 'd' 6 | . 'c' 'c' A 'g' 7 | . 'c' 'c' B 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'f' 2 | 'a' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 6 B go to state 7 State 2 3 S: 'b' . A 'f' 4 | 'b' . B 'g' 5 | 'b' . 'd' 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 8 A go to state 9 B go to state 10 State 3 6 S: 'c' . 'c' A 'g' 7 | 'c' . 'c' B 'c' shift, and go to state 11 State 4 0 \$accept: S . \$end \$end shift, and go to state 12 State 5 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 13 State 6 1 S: 'a' A . 'f' 'f' shift, and go to state 14 State 7 2 S: 'a' B . \$default reduce using rule 2 (S) State 8 5 S: 'b' 'd' . [\$end] 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 13 \$default reduce using rule 5 (S) State 9 3 S: 'b' A . 'f' 'f' shift, and go to state 15 State 10 4 S: 'b' B . 'g' 'g' shift, and go to state 16 State 11 6 S: 'c' 'c' . A 'g' 7 | 'c' 'c' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 17 B go to state 18 State 12 0 \$accept: S \$end . \$default accept State 13 8 A: 'd' 'e' . ['f', 'g'] 9 B: 'd' 'e' . [\$end, 'g'] \$end reduce using rule 9 (B) 'g' reduce using rule 8 (A) 'g' [reduce using rule 9 (B)] \$default reduce using rule 8 (A) State 14 1 S: 'a' A 'f' . \$default reduce using rule 1 (S) State 15 3 S: 'b' A 'f' . \$default reduce using rule 3 (S) State 16 4 S: 'b' B 'g' . \$default reduce using rule 4 (S) State 17 6 S: 'c' 'c' A . 'g' 'g' shift, and go to state 19 State 18 7 S: 'c' 'c' B . \$default reduce using rule 7 (S) State 19 6 S: 'c' 'c' A 'g' . \$default reduce using rule 6 (S) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1296" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1296" { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1296" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1296" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_195 #AT_START_196 at_fn_group_banner 196 'reduce.at:1296' \ "lr.type=ielr: Split During Added Lookahead Propagation" "" 8 at_xfail=no ( printf "%s\n" "196. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %define lr.keep-unreachable-state %% /* The partial state chart diagram below is for LALR(1). State 0 is the start state. States are iterated for successor construction in numerical order. Transitions are downwards. State 13 has a R/R conflict that cannot be predicted by Bison's LR(1) algorithm using annotations alone. That is, when state 11's successor on 'd' is merged with state 5 (which is originally just state 1's successor on 'd'), state 5's successor on 'e' must then be changed because the resulting lookaheads that propagate to it now make it incompatible with state 8's successor on 'e'. In other words, state 13 must be split to avoid the conflict. 0 / | \ a / c| \ b 1 3 2 | | | d| |c | d | 11 | | | | \ /d | 5 8 \ | e \ / e 13 R/R This grammar is designed carefully to make sure that, despite Bison's LR(1) algorithm's bread-first iteration of transitions to reconstruct states, state 11's successors are constructed after state 5's and state 8's. Otherwise (for example, if you remove the first 'c' in each of rules 6 and 7), state 5's successor on 'e' would never be merged with state 8's, so the split of the resulting state 13 would never need to be performed. */ S: 'a' A 'f' | 'a' B | 'b' A 'f' | 'b' B 'g' | 'b' 'd' | 'c' 'c' A 'g' | 'c' 'c' B ; A: 'd' 'e' ; B: 'd' 'e' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'd', 'e', 'g', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1296" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'f' 2 | . 'a' B 3 | . 'b' A 'f' 4 | . 'b' B 'g' 5 | . 'b' 'd' 6 | . 'c' 'c' A 'g' 7 | . 'c' 'c' B 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'f' 2 | 'a' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 6 B go to state 7 State 2 3 S: 'b' . A 'f' 4 | 'b' . B 'g' 5 | 'b' . 'd' 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 8 A go to state 9 B go to state 10 State 3 6 S: 'c' . 'c' A 'g' 7 | 'c' . 'c' B 'c' shift, and go to state 11 State 4 0 \$accept: S . \$end \$end shift, and go to state 12 State 5 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 20 State 6 1 S: 'a' A . 'f' 'f' shift, and go to state 14 State 7 2 S: 'a' B . \$default reduce using rule 2 (S) State 8 5 S: 'b' 'd' . [\$end] 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 13 \$default reduce using rule 5 (S) State 9 3 S: 'b' A . 'f' 'f' shift, and go to state 15 State 10 4 S: 'b' B . 'g' 'g' shift, and go to state 16 State 11 6 S: 'c' 'c' . A 'g' 7 | 'c' 'c' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 17 B go to state 18 State 12 0 \$accept: S \$end . \$default accept State 13 8 A: 'd' 'e' . ['f'] 9 B: 'd' 'e' . ['g'] 'g' reduce using rule 9 (B) \$default reduce using rule 8 (A) State 14 1 S: 'a' A 'f' . \$default reduce using rule 1 (S) State 15 3 S: 'b' A 'f' . \$default reduce using rule 3 (S) State 16 4 S: 'b' B 'g' . \$default reduce using rule 4 (S) State 17 6 S: 'c' 'c' A . 'g' 'g' shift, and go to state 19 State 18 7 S: 'c' 'c' B . \$default reduce using rule 7 (S) State 19 6 S: 'c' 'c' A 'g' . \$default reduce using rule 6 (S) State 20 8 A: 'd' 'e' . ['f', 'g'] 9 B: 'd' 'e' . [\$end] \$end reduce using rule 9 (B) \$default reduce using rule 8 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1296" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1296" { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1296" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1296" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_196 #AT_START_197 at_fn_group_banner 197 'reduce.at:1296' \ "lr.type=canonical-lr: Split During Added Lookahead Propagation" "" 8 at_xfail=no ( printf "%s\n" "197. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %define lr.keep-unreachable-state %% /* The partial state chart diagram below is for LALR(1). State 0 is the start state. States are iterated for successor construction in numerical order. Transitions are downwards. State 13 has a R/R conflict that cannot be predicted by Bison's LR(1) algorithm using annotations alone. That is, when state 11's successor on 'd' is merged with state 5 (which is originally just state 1's successor on 'd'), state 5's successor on 'e' must then be changed because the resulting lookaheads that propagate to it now make it incompatible with state 8's successor on 'e'. In other words, state 13 must be split to avoid the conflict. 0 / | \ a / c| \ b 1 3 2 | | | d| |c | d | 11 | | | | \ /d | 5 8 \ | e \ / e 13 R/R This grammar is designed carefully to make sure that, despite Bison's LR(1) algorithm's bread-first iteration of transitions to reconstruct states, state 11's successors are constructed after state 5's and state 8's. Otherwise (for example, if you remove the first 'c' in each of rules 6 and 7), state 5's successor on 'e' would never be merged with state 8's, so the split of the resulting state 13 would never need to be performed. */ S: 'a' A 'f' | 'a' B | 'b' A 'f' | 'b' B 'g' | 'b' 'd' | 'c' 'c' A 'g' | 'c' 'c' B ; A: 'd' 'e' ; B: 'd' 'e' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'b', 'd', 'e', 'g', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1296" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1296" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . S \$end 1 S: . 'a' A 'f' 2 | . 'a' B 3 | . 'b' A 'f' 4 | . 'b' B 'g' 5 | . 'b' 'd' 6 | . 'c' 'c' A 'g' 7 | . 'c' 'c' B 'a' shift, and go to state 1 'b' shift, and go to state 2 'c' shift, and go to state 3 S go to state 4 State 1 1 S: 'a' . A 'f' 2 | 'a' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 5 A go to state 6 B go to state 7 State 2 3 S: 'b' . A 'f' 4 | 'b' . B 'g' 5 | 'b' . 'd' 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 8 A go to state 9 B go to state 10 State 3 6 S: 'c' . 'c' A 'g' 7 | 'c' . 'c' B 'c' shift, and go to state 11 State 4 0 \$accept: S . \$end \$end shift, and go to state 12 State 5 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 13 State 6 1 S: 'a' A . 'f' 'f' shift, and go to state 14 State 7 2 S: 'a' B . [\$end] \$end reduce using rule 2 (S) State 8 5 S: 'b' 'd' . [\$end] 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 20 \$end reduce using rule 5 (S) State 9 3 S: 'b' A . 'f' 'f' shift, and go to state 15 State 10 4 S: 'b' B . 'g' 'g' shift, and go to state 16 State 11 6 S: 'c' 'c' . A 'g' 7 | 'c' 'c' . B 8 A: . 'd' 'e' 9 B: . 'd' 'e' 'd' shift, and go to state 21 A go to state 17 B go to state 18 State 12 0 \$accept: S \$end . \$default accept State 13 8 A: 'd' 'e' . ['f'] 9 B: 'd' 'e' . [\$end] \$end reduce using rule 9 (B) 'f' reduce using rule 8 (A) State 14 1 S: 'a' A 'f' . [\$end] \$end reduce using rule 1 (S) State 15 3 S: 'b' A 'f' . [\$end] \$end reduce using rule 3 (S) State 16 4 S: 'b' B 'g' . [\$end] \$end reduce using rule 4 (S) State 17 6 S: 'c' 'c' A . 'g' 'g' shift, and go to state 19 State 18 7 S: 'c' 'c' B . [\$end] \$end reduce using rule 7 (S) State 19 6 S: 'c' 'c' A 'g' . [\$end] \$end reduce using rule 6 (S) State 20 8 A: 'd' 'e' . ['f'] 9 B: 'd' 'e' . ['g'] 'f' reduce using rule 8 (A) 'g' reduce using rule 9 (B) State 21 8 A: 'd' . 'e' 9 B: 'd' . 'e' 'e' shift, and go to state 22 State 22 8 A: 'd' 'e' . ['g'] 9 B: 'd' 'e' . [\$end] \$end reduce using rule 9 (B) 'g' reduce using rule 8 (A) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "reduce.at:1296" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1296" { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1296" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1296" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1296: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1296" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1296" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_197 #AT_START_198 at_fn_group_banner 198 'reduce.at:1627' \ "no lr.default-reduction" " " 8 at_xfail=no ( printf "%s\n" "198. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% /* The start state is consistent and has a shift on 'a' and no reductions. After pushing the b below, enter an inconsistent state that has a shift and one reduction with one lookahead. */ start: a b | a b 'a' | a c 'b' ; /* After shifting this 'a', enter a consistent state that has no shift and 1 reduction with multiple lookaheads. */ a: 'a' ; /* After the previous reduction, enter an inconsistent state that has no shift and multiple reductions. The first reduction has more lookaheads than the second, so the first should always be preferred as the default reduction if enabled. The second reduction has one lookahead. */ b: %empty; c: %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'a', 'a', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1627" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . start \$end 1 start: . a b 2 | . a b 'a' 3 | . a c 'b' 4 a: . 'a' 'a' shift, and go to state 1 start go to state 2 a go to state 3 State 1 4 a: 'a' . \$default reduce using rule 4 (a) State 2 0 \$accept: start . \$end \$end shift, and go to state 4 State 3 1 start: a . b 2 | a . b 'a' 3 | a . c 'b' 5 b: %empty . [\$end, 'a'] 6 c: %empty . ['b'] 'b' reduce using rule 6 (c) \$default reduce using rule 5 (b) b go to state 5 c go to state 6 State 4 0 \$accept: start \$end . \$default accept State 5 1 start: a b . [\$end] 2 | a b . 'a' 'a' shift, and go to state 7 \$default reduce using rule 1 (start) State 6 3 start: a c . 'b' 'b' shift, and go to state 8 State 7 2 start: a b 'a' . \$default reduce using rule 2 (start) State 8 3 start: a c 'b' . \$default reduce using rule 3 (start) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1627" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1627" { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1627" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1627" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_198 #AT_START_199 at_fn_group_banner 199 'reduce.at:1627' \ "lr.default-reduction=most" " " 8 at_xfail=no ( printf "%s\n" "199. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.default-reduction most %% /* The start state is consistent and has a shift on 'a' and no reductions. After pushing the b below, enter an inconsistent state that has a shift and one reduction with one lookahead. */ start: a b | a b 'a' | a c 'b' ; /* After shifting this 'a', enter a consistent state that has no shift and 1 reduction with multiple lookaheads. */ a: 'a' ; /* After the previous reduction, enter an inconsistent state that has no shift and multiple reductions. The first reduction has more lookaheads than the second, so the first should always be preferred as the default reduction if enabled. The second reduction has one lookahead. */ b: %empty; c: %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'a', 'a', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1627" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . start \$end 1 start: . a b 2 | . a b 'a' 3 | . a c 'b' 4 a: . 'a' 'a' shift, and go to state 1 start go to state 2 a go to state 3 State 1 4 a: 'a' . \$default reduce using rule 4 (a) State 2 0 \$accept: start . \$end \$end shift, and go to state 4 State 3 1 start: a . b 2 | a . b 'a' 3 | a . c 'b' 5 b: %empty . [\$end, 'a'] 6 c: %empty . ['b'] 'b' reduce using rule 6 (c) \$default reduce using rule 5 (b) b go to state 5 c go to state 6 State 4 0 \$accept: start \$end . \$default accept State 5 1 start: a b . [\$end] 2 | a b . 'a' 'a' shift, and go to state 7 \$default reduce using rule 1 (start) State 6 3 start: a c . 'b' 'b' shift, and go to state 8 State 7 2 start: a b 'a' . \$default reduce using rule 2 (start) State 8 3 start: a c 'b' . \$default reduce using rule 3 (start) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1627" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1627" { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1627" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1627" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_199 #AT_START_200 at_fn_group_banner 200 'reduce.at:1627' \ "lr.default-reduction=consistent" " " 8 at_xfail=no ( printf "%s\n" "200. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.default-reduction consistent %% /* The start state is consistent and has a shift on 'a' and no reductions. After pushing the b below, enter an inconsistent state that has a shift and one reduction with one lookahead. */ start: a b | a b 'a' | a c 'b' ; /* After shifting this 'a', enter a consistent state that has no shift and 1 reduction with multiple lookaheads. */ a: 'a' ; /* After the previous reduction, enter an inconsistent state that has no shift and multiple reductions. The first reduction has more lookaheads than the second, so the first should always be preferred as the default reduction if enabled. The second reduction has one lookahead. */ b: %empty; c: %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'a', 'a', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1627" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . start \$end 1 start: . a b 2 | . a b 'a' 3 | . a c 'b' 4 a: . 'a' 'a' shift, and go to state 1 start go to state 2 a go to state 3 State 1 4 a: 'a' . \$default reduce using rule 4 (a) State 2 0 \$accept: start . \$end \$end shift, and go to state 4 State 3 1 start: a . b 2 | a . b 'a' 3 | a . c 'b' 5 b: %empty . [\$end, 'a'] 6 c: %empty . ['b'] \$end reduce using rule 5 (b) 'a' reduce using rule 5 (b) 'b' reduce using rule 6 (c) b go to state 5 c go to state 6 State 4 0 \$accept: start \$end . \$default accept State 5 1 start: a b . [\$end] 2 | a b . 'a' 'a' shift, and go to state 7 \$end reduce using rule 1 (start) State 6 3 start: a c . 'b' 'b' shift, and go to state 8 State 7 2 start: a b 'a' . \$default reduce using rule 2 (start) State 8 3 start: a c 'b' . \$default reduce using rule 3 (start) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1627" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1627" { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1627" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1627" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_200 #AT_START_201 at_fn_group_banner 201 'reduce.at:1627' \ "lr.default-reduction=accepting" " " 8 at_xfail=no ( printf "%s\n" "201. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.default-reduction accepting %% /* The start state is consistent and has a shift on 'a' and no reductions. After pushing the b below, enter an inconsistent state that has a shift and one reduction with one lookahead. */ start: a b | a b 'a' | a c 'b' ; /* After shifting this 'a', enter a consistent state that has no shift and 1 reduction with multiple lookaheads. */ a: 'a' ; /* After the previous reduction, enter an inconsistent state that has no shift and multiple reductions. The first reduction has more lookaheads than the second, so the first should always be preferred as the default reduction if enabled. The second reduction has one lookahead. */ b: %empty; c: %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 'a', 'a', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "reduce.at:1627" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed -n '/^State 0\$/,\$p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 0$/,$p' input.output" "reduce.at:1627" ( $at_check_trace; sed -n '/^State 0$/,$p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . start \$end 1 start: . a b 2 | . a b 'a' 3 | . a c 'b' 4 a: . 'a' 'a' shift, and go to state 1 start go to state 2 a go to state 3 State 1 4 a: 'a' . [\$end, 'a', 'b'] \$end reduce using rule 4 (a) 'a' reduce using rule 4 (a) 'b' reduce using rule 4 (a) State 2 0 \$accept: start . \$end \$end shift, and go to state 4 State 3 1 start: a . b 2 | a . b 'a' 3 | a . c 'b' 5 b: %empty . [\$end, 'a'] 6 c: %empty . ['b'] \$end reduce using rule 5 (b) 'a' reduce using rule 5 (b) 'b' reduce using rule 6 (c) b go to state 5 c go to state 6 State 4 0 \$accept: start \$end . \$default accept State 5 1 start: a b . [\$end] 2 | a b . 'a' 'a' shift, and go to state 7 \$end reduce using rule 1 (start) State 6 3 start: a c . 'b' 'b' shift, and go to state 8 State 7 2 start: a b 'a' . [\$end] \$end reduce using rule 2 (start) State 8 3 start: a c 'b' . [\$end] \$end reduce using rule 3 (start) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "reduce.at:1627" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/reduce.at:1627" { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "reduce.at:1627" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "reduce.at:1627" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/reduce.at:1627: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "reduce.at:1627" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/reduce.at:1627" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_201 #AT_START_202 at_fn_group_banner 202 'report.at:37' \ "Reports" " " 9 at_xfail=no ( printf "%s\n" "202. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %token END 0 "end of file" ASSIGN ":=" INCR "incr" ; %token IDENTIFIER "identifier" %type id %token NUMBER "number" %type exp %% %start unit; unit: assignments exp { driver.result = $2; }; assignments: %empty {} | assignments assignment {}; assignment: id ":=" exp { driver.variables[$id] = $exp; }; id: "identifier"; exp: "incr" exp { $$ = 1; } { $$ = 10; } exp { $$ = $2 + $3 + $4 + $5; } | "(" exp ")" { std::swap ($$, $2); } | "identifier" { $$ = driver.variables[$1]; } | "number" { std::swap ($$, $1); }; _ATEOF printf "%s\n" "report.at:75" >"$at_check_line_file" (test x"$XSLTPROC" = x) \ && at_fn_check_skip 77 "$at_srcdir/report.at:75" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/report.at:76: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc -v --html --xml input.yy" at_fn_check_prepare_notrace 'an embedded newline' "report.at:76" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc -v --html --xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:76" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:76: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -v --html --xml input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -v --html --xml input.yy" "report.at:76" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -v --html --xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:76" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/report.at:76: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "report.at:76" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:76" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/report.at:76: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "report.at:76" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:76" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/report.at:76: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "report.at:76" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:76" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/report.at:76: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -v --graph=input.gv --html --xml input.yy" at_fn_check_prepare_trace "report.at:76" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -v --graph=input.gv --html --xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:76" $at_failed && at_fn_log_failure $at_traceon; } # Check the contents of the report. { set +x printf "%s\n" "$at_srcdir/report.at:79: cat input.output" at_fn_check_prepare_trace "report.at:79" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Grammar 0 \$accept: unit \"end of file\" 1 unit: assignments exp 2 assignments: %empty 3 | assignments assignment 4 assignment: id \":=\" exp 5 id: \"identifier\" 6 @1: %empty 7 @2: %empty 8 exp: \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" Terminals, with rules where they appear \"end of file\" (0) 0 error (256) \":=\" (258) 4 \"incr\" (259) 8 \"identifier\" (260) 5 10 \"number\" (261) 11 \"(\" (262) 9 \")\" (263) 9 Nonterminals, with rules where they appear \$accept (9) on left: 0 unit (10) on left: 1 on right: 0 assignments (11) on left: 2 3 on right: 1 3 assignment (12) on left: 4 on right: 3 id (13) on left: 5 on right: 4 exp (14) on left: 8 9 10 11 on right: 1 4 8 9 @1 (15) on left: 6 on right: 8 @2 (16) on left: 7 on right: 8 State 0 0 \$accept: . unit \"end of file\" \$default reduce using rule 2 (assignments) unit go to state 1 assignments go to state 2 State 1 0 \$accept: unit . \"end of file\" \"end of file\" shift, and go to state 3 State 2 1 unit: assignments . exp 3 assignments: assignments . assignment \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 5 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 assignment go to state 8 id go to state 9 exp go to state 10 State 3 0 \$accept: unit \"end of file\" . \$default accept State 4 8 exp: \"incr\" . exp @1 @2 exp \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 12 State 5 5 id: \"identifier\" . 10 exp: \"identifier\" . \"end of file\" reduce using rule 10 (exp) \$default reduce using rule 5 (id) State 6 11 exp: \"number\" . \$default reduce using rule 11 (exp) State 7 9 exp: \"(\" . exp \")\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 13 State 8 3 assignments: assignments assignment . \$default reduce using rule 3 (assignments) State 9 4 assignment: id . \":=\" exp \":=\" shift, and go to state 14 State 10 1 unit: assignments exp . \$default reduce using rule 1 (unit) State 11 10 exp: \"identifier\" . \$default reduce using rule 10 (exp) State 12 8 exp: \"incr\" exp . @1 @2 exp \$default reduce using rule 6 (@1) @1 go to state 15 State 13 9 exp: \"(\" exp . \")\" \")\" shift, and go to state 16 State 14 4 assignment: id \":=\" . exp \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 17 State 15 8 exp: \"incr\" exp @1 . @2 exp \$default reduce using rule 7 (@2) @2 go to state 18 State 16 9 exp: \"(\" exp \")\" . \$default reduce using rule 9 (exp) State 17 4 assignment: id \":=\" exp . \$default reduce using rule 4 (assignment) State 18 8 exp: \"incr\" exp @1 @2 . exp \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 19 State 19 8 exp: \"incr\" exp @1 @2 exp . \$default reduce using rule 8 (exp) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:79" $at_failed && at_fn_log_failure $at_traceon; } # Now generate verbose reports. printf "%s\n" "report.at:321" >"$at_check_line_file" (test x"$XSLTPROC" = x) \ && at_fn_check_skip 77 "$at_srcdir/report.at:321" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/report.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc -rall --html --xml input.yy" at_fn_check_prepare_notrace 'an embedded newline' "report.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc -rall --html --xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:322" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -rall --html --xml input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -rall --html --xml input.yy" "report.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -rall --html --xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:322" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/report.at:322: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "report.at:322" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:322" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/report.at:322: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "report.at:322" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:322" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/report.at:322: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "report.at:322" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/report.at:322" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/report.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -rall --graph=input.gv --html --xml input.yy" at_fn_check_prepare_trace "report.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -rall --graph=input.gv --html --xml input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:322" $at_failed && at_fn_log_failure $at_traceon; } # Check the contents of the report. { set +x printf "%s\n" "$at_srcdir/report.at:325: cat input.output" at_fn_check_prepare_trace "report.at:325" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Grammar 0 \$accept: unit \"end of file\" 1 unit: assignments exp 2 assignments: %empty 3 | assignments assignment 4 assignment: id \":=\" exp 5 id: \"identifier\" 6 @1: %empty 7 @2: %empty 8 exp: \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" Terminals, with rules where they appear \"end of file\" (0) 0 error (256) \":=\" (258) 4 \"incr\" (259) 8 \"identifier\" (260) 5 10 \"number\" (261) 11 \"(\" (262) 9 \")\" (263) 9 Nonterminals, with rules where they appear \$accept (9) on left: 0 unit (10) on left: 1 on right: 0 assignments (11) on left: 2 3 on right: 1 3 assignment (12) on left: 4 on right: 3 id (13) on left: 5 on right: 4 exp (14) on left: 8 9 10 11 on right: 1 4 8 9 @1 (15) on left: 6 on right: 8 @2 (16) on left: 7 on right: 8 State 0 0 \$accept: . unit \"end of file\" 1 unit: . assignments exp 2 assignments: %empty . 3 | . assignments assignment \$default reduce using rule 2 (assignments) unit go to state 1 assignments go to state 2 State 1 0 \$accept: unit . \"end of file\" \"end of file\" shift, and go to state 3 State 2 1 unit: assignments . exp 3 assignments: assignments . assignment 4 assignment: . id \":=\" exp 5 id: . \"identifier\" 8 exp: . \"incr\" exp @1 @2 exp 9 | . \"(\" exp \")\" 10 | . \"identifier\" 11 | . \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 5 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 assignment go to state 8 id go to state 9 exp go to state 10 State 3 0 \$accept: unit \"end of file\" . \$default accept State 4 8 exp: . \"incr\" exp @1 @2 exp 8 | \"incr\" . exp @1 @2 exp 9 | . \"(\" exp \")\" 10 | . \"identifier\" 11 | . \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 12 State 5 5 id: \"identifier\" . [\":=\"] 10 exp: \"identifier\" . [\"end of file\"] \"end of file\" reduce using rule 10 (exp) \$default reduce using rule 5 (id) State 6 11 exp: \"number\" . \$default reduce using rule 11 (exp) State 7 8 exp: . \"incr\" exp @1 @2 exp 9 | . \"(\" exp \")\" 9 | \"(\" . exp \")\" 10 | . \"identifier\" 11 | . \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 13 State 8 3 assignments: assignments assignment . \$default reduce using rule 3 (assignments) State 9 4 assignment: id . \":=\" exp \":=\" shift, and go to state 14 State 10 1 unit: assignments exp . \$default reduce using rule 1 (unit) State 11 10 exp: \"identifier\" . \$default reduce using rule 10 (exp) State 12 6 @1: %empty . 8 exp: \"incr\" exp . @1 @2 exp \$default reduce using rule 6 (@1) @1 go to state 15 State 13 9 exp: \"(\" exp . \")\" \")\" shift, and go to state 16 State 14 4 assignment: id \":=\" . exp 8 exp: . \"incr\" exp @1 @2 exp 9 | . \"(\" exp \")\" 10 | . \"identifier\" 11 | . \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 17 State 15 7 @2: %empty . 8 exp: \"incr\" exp @1 . @2 exp \$default reduce using rule 7 (@2) @2 go to state 18 State 16 9 exp: \"(\" exp \")\" . \$default reduce using rule 9 (exp) State 17 4 assignment: id \":=\" exp . \$default reduce using rule 4 (assignment) State 18 8 exp: . \"incr\" exp @1 @2 exp 8 | \"incr\" exp @1 @2 . exp 9 | . \"(\" exp \")\" 10 | . \"identifier\" 11 | . \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 19 State 19 8 exp: \"incr\" exp @1 @2 exp . \$default reduce using rule 8 (exp) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:325" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:594: cat input.gv" at_fn_check_prepare_trace "report.at:594" ( $at_check_trace; cat input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "// Generated by GNU Bison 3.8.2. // Report bugs to . // Home page: . digraph \"input.yy\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • unit \\\"end of file\\\"\\l 1 unit: • assignments exp\\l 2 assignments: • %empty\\l 3 | • assignments assignment\\l\"] 0 -> 1 [style=dashed label=\"unit\"] 0 -> 2 [style=dashed label=\"assignments\"] 0 -> \"0R2\" [style=solid] \"0R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 1 [label=\"State 1\\n\\l 0 \$accept: unit • \\\"end of file\\\"\\l\"] 1 -> 3 [style=solid label=\"\\\"end of file\\\"\"] 2 [label=\"State 2\\n\\l 1 unit: assignments • exp\\l 3 assignments: assignments • assignment\\l 4 assignment: • id \\\":=\\\" exp\\l 5 id: • \\\"identifier\\\"\\l 8 exp: • \\\"incr\\\" exp @1 @2 exp\\l 9 | • \\\"(\\\" exp \\\")\\\"\\l 10 | • \\\"identifier\\\"\\l 11 | • \\\"number\\\"\\l\"] 2 -> 4 [style=solid label=\"\\\"incr\\\"\"] 2 -> 5 [style=solid label=\"\\\"identifier\\\"\"] 2 -> 6 [style=solid label=\"\\\"number\\\"\"] 2 -> 7 [style=solid label=\"\\\"(\\\"\"] 2 -> 8 [style=dashed label=\"assignment\"] 2 -> 9 [style=dashed label=\"id\"] 2 -> 10 [style=dashed label=\"exp\"] 3 [label=\"State 3\\n\\l 0 \$accept: unit \\\"end of file\\\" •\\l\"] 3 -> \"3R0\" [style=solid] \"3R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 4 [label=\"State 4\\n\\l 8 exp: • \\\"incr\\\" exp @1 @2 exp\\l 8 | \\\"incr\\\" • exp @1 @2 exp\\l 9 | • \\\"(\\\" exp \\\")\\\"\\l 10 | • \\\"identifier\\\"\\l 11 | • \\\"number\\\"\\l\"] 4 -> 4 [style=solid label=\"\\\"incr\\\"\"] 4 -> 11 [style=solid label=\"\\\"identifier\\\"\"] 4 -> 6 [style=solid label=\"\\\"number\\\"\"] 4 -> 7 [style=solid label=\"\\\"(\\\"\"] 4 -> 12 [style=dashed label=\"exp\"] 5 [label=\"State 5\\n\\l 5 id: \\\"identifier\\\" • [\\\":=\\\"]\\l 10 exp: \\\"identifier\\\" • [\\\"end of file\\\"]\\l\"] 5 -> \"5R5\" [style=solid] \"5R5\" [label=\"R5\", fillcolor=3, shape=diamond, style=filled] 5 -> \"5R10\" [label=\"[\\\"end of file\\\"]\", style=solid] \"5R10\" [label=\"R10\", fillcolor=3, shape=diamond, style=filled] 6 [label=\"State 6\\n\\l 11 exp: \\\"number\\\" •\\l\"] 6 -> \"6R11\" [style=solid] \"6R11\" [label=\"R11\", fillcolor=3, shape=diamond, style=filled] 7 [label=\"State 7\\n\\l 8 exp: • \\\"incr\\\" exp @1 @2 exp\\l 9 | • \\\"(\\\" exp \\\")\\\"\\l 9 | \\\"(\\\" • exp \\\")\\\"\\l 10 | • \\\"identifier\\\"\\l 11 | • \\\"number\\\"\\l\"] 7 -> 4 [style=solid label=\"\\\"incr\\\"\"] 7 -> 11 [style=solid label=\"\\\"identifier\\\"\"] 7 -> 6 [style=solid label=\"\\\"number\\\"\"] 7 -> 7 [style=solid label=\"\\\"(\\\"\"] 7 -> 13 [style=dashed label=\"exp\"] 8 [label=\"State 8\\n\\l 3 assignments: assignments assignment •\\l\"] 8 -> \"8R3\" [style=solid] \"8R3\" [label=\"R3\", fillcolor=3, shape=diamond, style=filled] 9 [label=\"State 9\\n\\l 4 assignment: id • \\\":=\\\" exp\\l\"] 9 -> 14 [style=solid label=\"\\\":=\\\"\"] 10 [label=\"State 10\\n\\l 1 unit: assignments exp •\\l\"] 10 -> \"10R1\" [style=solid] \"10R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] 11 [label=\"State 11\\n\\l 10 exp: \\\"identifier\\\" •\\l\"] 11 -> \"11R10\" [style=solid] \"11R10\" [label=\"R10\", fillcolor=3, shape=diamond, style=filled] 12 [label=\"State 12\\n\\l 6 @1: • %empty\\l 8 exp: \\\"incr\\\" exp • @1 @2 exp\\l\"] 12 -> 15 [style=dashed label=\"@1\"] 12 -> \"12R6\" [style=solid] \"12R6\" [label=\"R6\", fillcolor=3, shape=diamond, style=filled] 13 [label=\"State 13\\n\\l 9 exp: \\\"(\\\" exp • \\\")\\\"\\l\"] 13 -> 16 [style=solid label=\"\\\")\\\"\"] 14 [label=\"State 14\\n\\l 4 assignment: id \\\":=\\\" • exp\\l 8 exp: • \\\"incr\\\" exp @1 @2 exp\\l 9 | • \\\"(\\\" exp \\\")\\\"\\l 10 | • \\\"identifier\\\"\\l 11 | • \\\"number\\\"\\l\"] 14 -> 4 [style=solid label=\"\\\"incr\\\"\"] 14 -> 11 [style=solid label=\"\\\"identifier\\\"\"] 14 -> 6 [style=solid label=\"\\\"number\\\"\"] 14 -> 7 [style=solid label=\"\\\"(\\\"\"] 14 -> 17 [style=dashed label=\"exp\"] 15 [label=\"State 15\\n\\l 7 @2: • %empty\\l 8 exp: \\\"incr\\\" exp @1 • @2 exp\\l\"] 15 -> 18 [style=dashed label=\"@2\"] 15 -> \"15R7\" [style=solid] \"15R7\" [label=\"R7\", fillcolor=3, shape=diamond, style=filled] 16 [label=\"State 16\\n\\l 9 exp: \\\"(\\\" exp \\\")\\\" •\\l\"] 16 -> \"16R9\" [style=solid] \"16R9\" [label=\"R9\", fillcolor=3, shape=diamond, style=filled] 17 [label=\"State 17\\n\\l 4 assignment: id \\\":=\\\" exp •\\l\"] 17 -> \"17R4\" [style=solid] \"17R4\" [label=\"R4\", fillcolor=3, shape=diamond, style=filled] 18 [label=\"State 18\\n\\l 8 exp: • \\\"incr\\\" exp @1 @2 exp\\l 8 | \\\"incr\\\" exp @1 @2 • exp\\l 9 | • \\\"(\\\" exp \\\")\\\"\\l 10 | • \\\"identifier\\\"\\l 11 | • \\\"number\\\"\\l\"] 18 -> 4 [style=solid label=\"\\\"incr\\\"\"] 18 -> 11 [style=solid label=\"\\\"identifier\\\"\"] 18 -> 6 [style=solid label=\"\\\"number\\\"\"] 18 -> 7 [style=solid label=\"\\\"(\\\"\"] 18 -> 19 [style=dashed label=\"exp\"] 19 [label=\"State 19\\n\\l 8 exp: \\\"incr\\\" exp @1 @2 exp •\\l\"] 19 -> \"19R8\" [style=solid] \"19R8\" [label=\"R8\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:594" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:688: cat input.xml" at_fn_check_prepare_trace "report.at:688" ( $at_check_trace; cat input.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " input.yy \$accept unit "end of file" unit assignments exp assignments assignments assignments assignment assignment id ":=" exp id "identifier" @1 @2 exp "incr" exp @1 @2 exp exp "(" exp ")" exp "identifier" exp "number" ":=" "end of file" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:688" $at_failed && at_fn_log_failure $at_traceon; } # Check HTML output. { set +x printf "%s\n" "$at_srcdir/report.at:1156: sed -e 's|content=\"text/html; charset=UTF-8\"|content=\"text/html;charset=UTF-8\"|g' input.html" at_fn_check_prepare_notrace 'a shell pipeline' "report.at:1156" ( $at_check_trace; sed -e 's|content="text/html; charset=UTF-8"|content="text/html;charset=UTF-8"|g' input.html ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " input.yy - GNU Bison XML Automaton Report

GNU Bison XML Automaton Report

input grammar: input.yy

Table of Contents

Reductions

Nonterminals useless in grammar

Terminals unused in grammar

Rules useless in grammar

Conflicts

Grammar

0 \$acceptunit \"end of file\" 1 unitassignments exp 2 assignments → %empty 3 | assignments assignment 4 assignmentid \":=\" exp 5 id\"identifier\" 6 @1 → %empty 7 @2 → %empty 8 exp\"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\"

Terminals, with rules where they appear

  • \"end of file\" (0) 0
  • error (256)
  • \":=\" (258) 4
  • \"incr\" (259) 8
  • \"identifier\" <std::string> (260) 5 10
  • \"number\" <int> (261) 11
  • \"(\" (262) 9
  • \")\" (263) 9

Nonterminals, with rules where they appear

  • \$accept (9)
    • on left: 0
  • unit (10)
    • on left: 1
    • on right: 0
  • assignments (11)
    • on left: 2 3
    • on right: 1 3
  • assignment (12)
    • on left: 4
    • on right: 3
  • id <std::string> (13)
    • on left: 5
    • on right: 4
  • exp <int> (14)
  • @1 <int> (15)
    • on left: 6
    • on right: 8
  • @2 <int> (16)
    • on left: 7
    • on right: 8

Automaton

State 0

0 \$accept unit \"end of file\" 1 unit assignments exp 2 assignments %empty 3 | assignments assignment \$default reduce using rule 2 (assignments) unit go to state 1 assignments go to state 2

State 1

0 \$acceptunit \"end of file\" \"end of file\" shift, and go to state 3

State 2

1 unitassignments exp 3 assignmentsassignments assignment 4 assignment id \":=\" exp 5 id \"identifier\" 8 exp \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 5 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 assignment go to state 8 id go to state 9 exp go to state 10

State 3

0 \$acceptunit \"end of file\" \$default accept

State 4

8 exp \"incr\" exp @1 @2 exp 8 | \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 12

State 5

5 id\"identifier\" [\":=\"] 10 exp\"identifier\" [\"end of file\"] \"end of file\" reduce using rule 10 (exp) \$default reduce using rule 5 (id)

State 6

11 exp\"number\" \$default reduce using rule 11 (exp)

State 7

8 exp \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 13

State 8

3 assignmentsassignments assignment \$default reduce using rule 3 (assignments)

State 9

4 assignmentid \":=\" exp \":=\" shift, and go to state 14

State 10

1 unitassignments exp \$default reduce using rule 1 (unit)

State 11

10 exp\"identifier\" \$default reduce using rule 10 (exp)

State 12

6 @1 %empty 8 exp\"incr\" exp @1 @2 exp \$default reduce using rule 6 (@1) @1 go to state 15

State 13

9 exp\"(\" exp \")\" \")\" shift, and go to state 16

State 14

4 assignmentid \":=\" exp 8 exp \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 17

State 15

7 @2 %empty 8 exp\"incr\" exp @1 @2 exp \$default reduce using rule 7 (@2) @2 go to state 18

State 16

9 exp\"(\" exp \")\" \$default reduce using rule 9 (exp)

State 17

4 assignmentid \":=\" exp \$default reduce using rule 4 (assignment)

State 18

8 exp \"incr\" exp @1 @2 exp 8 | \"incr\" exp @1 @2 exp 9 | \"(\" exp \")\" 10 | \"identifier\" 11 | \"number\" \"incr\" shift, and go to state 4 \"identifier\" shift, and go to state 11 \"number\" shift, and go to state 6 \"(\" shift, and go to state 7 exp go to state 19

State 19

8 exp\"incr\" exp @1 @2 exp \$default reduce using rule 8 (exp)


This document was generated using GNU Bison 3.8.2 XML Automaton Report.
Verbatim copying and distribution of this entire page is permitted in any medium, provided this notice is preserved.
" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:1156" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_202 #AT_START_203 at_fn_group_banner 203 'report.at:3123' \ "Reports with conflicts" " " 9 at_xfail=no ( printf "%s\n" "203. $at_setup_line: testing $at_desc ..." $at_traceon # We need UTF-8 support for correct screen-width computation of UTF-8 # characters. Skip the test if not available. locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q` printf "%s\n" "report.at:3130" >"$at_check_line_file" (test x = x"$locale") \ && at_fn_check_skip 77 "$at_srcdir/report.at:3130" printf "%s\n" "report.at:3132" >"$at_check_line_file" (test x"$XSLTPROC" = x) \ && at_fn_check_skip 77 "$at_srcdir/report.at:3132" cat >input.y <<'_ATEOF' %left "+" %% exp : exp "⊕" exp | exp "+" exp | exp "+" exp | "number" | "Ñùṃéℝô" _ATEOF { set +x printf "%s\n" "$at_srcdir/report.at:3146: LC_ALL=\"\$locale\" bison -fno-caret -o input.cc -rall -Wcex --graph=input.gv --html --xml input.y" at_fn_check_prepare_dynamic "LC_ALL=\"$locale\" bison -fno-caret -o input.cc -rall -Wcex --graph=input.gv --html --xml input.y" "report.at:3146" ( $at_check_trace; LC_ALL="$locale" bison -fno-caret -o input.cc -rall -Wcex --graph=input.gv --html --xml input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: shift/reduce conflict on token \"⊕\" [-Wcounterexamples] Example: exp \"+\" exp • \"⊕\" exp Shift derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp • \"⊕\" exp Reduce derivation exp ↳ 1: exp \"⊕\" exp ↳ 2: exp \"+\" exp • input.y: warning: reduce/reduce conflict on tokens \$end, \"+\", \"⊕\" [-Wcounterexamples] Example: exp \"+\" exp • First reduce derivation exp ↳ 2: exp \"+\" exp • Second reduce derivation exp ↳ 3: exp \"+\" exp • input.y: warning: shift/reduce conflict on token \"⊕\" [-Wcounterexamples] Example: exp \"+\" exp • \"⊕\" exp Shift derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp • \"⊕\" exp Reduce derivation exp ↳ 1: exp \"⊕\" exp ↳ 3: exp \"+\" exp • input.y: warning: shift/reduce conflict on token \"⊕\" [-Wcounterexamples] Example: exp \"⊕\" exp • \"⊕\" exp Shift derivation exp ↳ 1: exp \"⊕\" exp ↳ 1: exp • \"⊕\" exp Reduce derivation exp ↳ 1: exp \"⊕\" exp ↳ 1: exp \"⊕\" exp • input.y: warning: shift/reduce conflict on token \"+\" [-Wcounterexamples] Example: exp \"⊕\" exp • \"+\" exp Shift derivation exp ↳ 1: exp \"⊕\" exp ↳ 2: exp • \"+\" exp Reduce derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp \"⊕\" exp • input.y: warning: shift/reduce conflict on token \"+\" [-Wcounterexamples] Example: exp \"⊕\" exp • \"+\" exp Shift derivation exp ↳ 1: exp \"⊕\" exp ↳ 3: exp • \"+\" exp Reduce derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp \"⊕\" exp • input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:3146" $at_failed && at_fn_log_failure $at_traceon; } # Check the contents of the report. # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/report.at:3212: sed -e 's/ *\$//' input.output" at_fn_check_prepare_dynamic "sed -e 's/ *$//' input.output" "report.at:3212" ( $at_check_trace; sed -e 's/ *$//' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Rules useless in parser due to conflicts 3 exp: exp \"+\" exp State 7 conflicts: 1 shift/reduce, 3 reduce/reduce State 8 conflicts: 2 shift/reduce Grammar 0 \$accept: exp \$end 1 exp: exp \"⊕\" exp 2 | exp \"+\" exp 3 | exp \"+\" exp 4 | \"number\" 5 | \"Ñùṃéℝô\" Terminals, with rules where they appear \$end (0) 0 error (256) \"+\" (258) 2 3 \"⊕\" (259) 1 \"number\" (260) 4 \"Ñùṃéℝô\" (261) 5 Nonterminals, with rules where they appear \$accept (7) on left: 0 exp (8) on left: 1 2 3 4 5 on right: 0 1 2 3 State 0 0 \$accept: • exp \$end 1 exp: • exp \"⊕\" exp 2 | • exp \"+\" exp 3 | • exp \"+\" exp 4 | • \"number\" 5 | • \"Ñùṃéℝô\" \"number\" shift, and go to state 1 \"Ñùṃéℝô\" shift, and go to state 2 exp go to state 3 State 1 4 exp: \"number\" • \$default reduce using rule 4 (exp) State 2 5 exp: \"Ñùṃéℝô\" • \$default reduce using rule 5 (exp) State 3 0 \$accept: exp • \$end 1 exp: exp • \"⊕\" exp 2 | exp • \"+\" exp 3 | exp • \"+\" exp \$end shift, and go to state 4 \"+\" shift, and go to state 5 \"⊕\" shift, and go to state 6 State 4 0 \$accept: exp \$end • \$default accept State 5 1 exp: • exp \"⊕\" exp 2 | • exp \"+\" exp 2 | exp \"+\" • exp 3 | • exp \"+\" exp 3 | exp \"+\" • exp 4 | • \"number\" 5 | • \"Ñùṃéℝô\" \"number\" shift, and go to state 1 \"Ñùṃéℝô\" shift, and go to state 2 exp go to state 7 State 6 1 exp: • exp \"⊕\" exp 1 | exp \"⊕\" • exp 2 | • exp \"+\" exp 3 | • exp \"+\" exp 4 | • \"number\" 5 | • \"Ñùṃéℝô\" \"number\" shift, and go to state 1 \"Ñùṃéℝô\" shift, and go to state 2 exp go to state 8 State 7 1 exp: exp • \"⊕\" exp 2 | exp • \"+\" exp 2 | exp \"+\" exp • [\$end, \"+\", \"⊕\"] 3 | exp • \"+\" exp 3 | exp \"+\" exp • [\$end, \"+\", \"⊕\"] \"⊕\" shift, and go to state 6 \$end reduce using rule 2 (exp) \$end [reduce using rule 3 (exp)] \"+\" reduce using rule 2 (exp) \"+\" [reduce using rule 3 (exp)] \"⊕\" [reduce using rule 2 (exp)] \"⊕\" [reduce using rule 3 (exp)] \$default reduce using rule 2 (exp) Conflict between rule 2 and token \"+\" resolved as reduce (%left \"+\"). shift/reduce conflict on token \"⊕\": 2 exp: exp \"+\" exp • 1 exp: exp • \"⊕\" exp Example: exp \"+\" exp • \"⊕\" exp Shift derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp • \"⊕\" exp Reduce derivation exp ↳ 1: exp \"⊕\" exp ↳ 2: exp \"+\" exp • reduce/reduce conflict on tokens \$end, \"+\", \"⊕\": 2 exp: exp \"+\" exp • 3 exp: exp \"+\" exp • Example: exp \"+\" exp • First reduce derivation exp ↳ 2: exp \"+\" exp • Second reduce derivation exp ↳ 3: exp \"+\" exp • shift/reduce conflict on token \"⊕\": 3 exp: exp \"+\" exp • 1 exp: exp • \"⊕\" exp Example: exp \"+\" exp • \"⊕\" exp Shift derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp • \"⊕\" exp Reduce derivation exp ↳ 1: exp \"⊕\" exp ↳ 3: exp \"+\" exp • State 8 1 exp: exp • \"⊕\" exp 1 | exp \"⊕\" exp • [\$end, \"+\", \"⊕\"] 2 | exp • \"+\" exp 3 | exp • \"+\" exp \"+\" shift, and go to state 5 \"⊕\" shift, and go to state 6 \"+\" [reduce using rule 1 (exp)] \"⊕\" [reduce using rule 1 (exp)] \$default reduce using rule 1 (exp) shift/reduce conflict on token \"⊕\": 1 exp: exp \"⊕\" exp • 1 exp: exp • \"⊕\" exp Example: exp \"⊕\" exp • \"⊕\" exp Shift derivation exp ↳ 1: exp \"⊕\" exp ↳ 1: exp • \"⊕\" exp Reduce derivation exp ↳ 1: exp \"⊕\" exp ↳ 1: exp \"⊕\" exp • shift/reduce conflict on token \"+\": 1 exp: exp \"⊕\" exp • 2 exp: exp • \"+\" exp Example: exp \"⊕\" exp • \"+\" exp Shift derivation exp ↳ 1: exp \"⊕\" exp ↳ 2: exp • \"+\" exp Reduce derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp \"⊕\" exp • shift/reduce conflict on token \"+\": 1 exp: exp \"⊕\" exp • 3 exp: exp • \"+\" exp Example: exp \"⊕\" exp • \"+\" exp Shift derivation exp ↳ 1: exp \"⊕\" exp ↳ 3: exp • \"+\" exp Reduce derivation exp ↳ 2: exp \"+\" exp ↳ 1: exp \"⊕\" exp • " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:3212" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:3448: cat input.gv" at_fn_check_prepare_trace "report.at:3448" ( $at_check_trace; cat input.gv ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "// Generated by GNU Bison 3.8.2. // Report bugs to . // Home page: . digraph \"input.y\" { node [fontname = courier, shape = box, colorscheme = paired6] edge [fontname = courier] 0 [label=\"State 0\\n\\l 0 \$accept: • exp \$end\\l 1 exp: • exp \\\"⊕\\\" exp\\l 2 | • exp \\\"+\\\" exp\\l 3 | • exp \\\"+\\\" exp\\l 4 | • \\\"number\\\"\\l 5 | • \\\"Ñùṃéℝô\\\"\\l\"] 0 -> 1 [style=solid label=\"\\\"number\\\"\"] 0 -> 2 [style=solid label=\"\\\"Ñùṃéℝô\\\"\"] 0 -> 3 [style=dashed label=\"exp\"] 1 [label=\"State 1\\n\\l 4 exp: \\\"number\\\" •\\l\"] 1 -> \"1R4\" [style=solid] \"1R4\" [label=\"R4\", fillcolor=3, shape=diamond, style=filled] 2 [label=\"State 2\\n\\l 5 exp: \\\"Ñùṃéℝô\\\" •\\l\"] 2 -> \"2R5\" [style=solid] \"2R5\" [label=\"R5\", fillcolor=3, shape=diamond, style=filled] 3 [label=\"State 3\\n\\l 0 \$accept: exp • \$end\\l 1 exp: exp • \\\"⊕\\\" exp\\l 2 | exp • \\\"+\\\" exp\\l 3 | exp • \\\"+\\\" exp\\l\"] 3 -> 4 [style=solid label=\"\$end\"] 3 -> 5 [style=solid label=\"\\\"+\\\"\"] 3 -> 6 [style=solid label=\"\\\"⊕\\\"\"] 4 [label=\"State 4\\n\\l 0 \$accept: exp \$end •\\l\"] 4 -> \"4R0\" [style=solid] \"4R0\" [label=\"Acc\", fillcolor=1, shape=diamond, style=filled] 5 [label=\"State 5\\n\\l 1 exp: • exp \\\"⊕\\\" exp\\l 2 | • exp \\\"+\\\" exp\\l 2 | exp \\\"+\\\" • exp\\l 3 | • exp \\\"+\\\" exp\\l 3 | exp \\\"+\\\" • exp\\l 4 | • \\\"number\\\"\\l 5 | • \\\"Ñùṃéℝô\\\"\\l\"] 5 -> 1 [style=solid label=\"\\\"number\\\"\"] 5 -> 2 [style=solid label=\"\\\"Ñùṃéℝô\\\"\"] 5 -> 7 [style=dashed label=\"exp\"] 6 [label=\"State 6\\n\\l 1 exp: • exp \\\"⊕\\\" exp\\l 1 | exp \\\"⊕\\\" • exp\\l 2 | • exp \\\"+\\\" exp\\l 3 | • exp \\\"+\\\" exp\\l 4 | • \\\"number\\\"\\l 5 | • \\\"Ñùṃéℝô\\\"\\l\"] 6 -> 1 [style=solid label=\"\\\"number\\\"\"] 6 -> 2 [style=solid label=\"\\\"Ñùṃéℝô\\\"\"] 6 -> 8 [style=dashed label=\"exp\"] 7 [label=\"State 7\\n\\l 1 exp: exp • \\\"⊕\\\" exp\\l 2 | exp • \\\"+\\\" exp\\l 2 | exp \\\"+\\\" exp • [\$end, \\\"+\\\", \\\"⊕\\\"]\\l 3 | exp • \\\"+\\\" exp\\l 3 | exp \\\"+\\\" exp • [\$end, \\\"+\\\", \\\"⊕\\\"]\\l\"] 7 -> 6 [style=solid label=\"\\\"⊕\\\"\"] 7 -> \"7R2d\" [label=\"[\\\"⊕\\\"]\", style=solid] \"7R2d\" [label=\"R2\", fillcolor=5, shape=diamond, style=filled] 7 -> \"7R2\" [style=solid] \"7R2\" [label=\"R2\", fillcolor=3, shape=diamond, style=filled] 7 -> \"7R3d\" [label=\"[\$end, \\\"+\\\", \\\"⊕\\\"]\", style=solid] \"7R3d\" [label=\"R3\", fillcolor=5, shape=diamond, style=filled] 8 [label=\"State 8\\n\\l 1 exp: exp • \\\"⊕\\\" exp\\l 1 | exp \\\"⊕\\\" exp • [\$end, \\\"+\\\", \\\"⊕\\\"]\\l 2 | exp • \\\"+\\\" exp\\l 3 | exp • \\\"+\\\" exp\\l\"] 8 -> 5 [style=solid label=\"\\\"+\\\"\"] 8 -> 6 [style=solid label=\"\\\"⊕\\\"\"] 8 -> \"8R1d\" [label=\"[\\\"+\\\", \\\"⊕\\\"]\", style=solid] \"8R1d\" [label=\"R1\", fillcolor=5, shape=diamond, style=filled] 8 -> \"8R1\" [style=solid] \"8R1\" [label=\"R1\", fillcolor=3, shape=diamond, style=filled] } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:3448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:3502: cat input.xml" at_fn_check_prepare_trace "report.at:3502" ( $at_check_trace; cat input.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " input.y \$accept exp \$end exp exp "⊕" exp exp exp "+" exp exp exp "+" exp exp "number" exp "Ñùṃéℝô" \$end "+" "⊕" \$end "+" "⊕" %left "+" \$end "+" "⊕" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:3502" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/report.at:3768: sed -e 's|content=\"text/html; charset=UTF-8\"|content=\"text/html;charset=UTF-8\"|g' input.html" at_fn_check_prepare_notrace 'a shell pipeline' "report.at:3768" ( $at_check_trace; sed -e 's|content="text/html; charset=UTF-8"|content="text/html;charset=UTF-8"|g' input.html ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " input.y - GNU Bison XML Automaton Report

GNU Bison XML Automaton Report

input grammar: input.y

Table of Contents

Reductions

Nonterminals useless in grammar

Terminals unused in grammar

Rules useless in grammar

Rules useless in parser due to conflicts

3 expexp \"+\" exp

Conflicts

State 7 conflicts: 1 shift/reduce, 3 reduce/reduce State 8 conflicts: 2 shift/reduce

Grammar

0 \$acceptexp \$end 1 expexp \"⊕\" exp 2 | exp \"+\" exp 3 | exp \"+\" exp 4 | \"number\" 5 | \"Ñùṃéℝô\"

Terminals, with rules where they appear

  • \$end (0) 0
  • error (256)
  • \"+\" (258) 2 3
  • \"⊕\" (259) 1
  • \"number\" (260) 4
  • \"Ñùṃéℝô\" (261) 5

Nonterminals, with rules where they appear

  • \$accept (7)
    • on left: 0
  • exp (8)

Automaton

State 0

0 \$accept exp \$end 1 exp exp \"⊕\" exp 2 | exp \"+\" exp 3 | exp \"+\" exp 4 | \"number\" 5 | \"Ñùṃéℝô\" \"number\" shift, and go to state 1 \"Ñùṃéℝô\" shift, and go to state 2 exp go to state 3

State 1

4 exp\"number\" \$default reduce using rule 4 (exp)

State 2

5 exp\"Ñùṃéℝô\" \$default reduce using rule 5 (exp)

State 3

0 \$acceptexp \$end 1 expexp \"⊕\" exp 2 | exp \"+\" exp 3 | exp \"+\" exp \$end shift, and go to state 4 \"+\" shift, and go to state 5 \"⊕\" shift, and go to state 6

State 4

0 \$acceptexp \$end \$default accept

State 5

1 exp exp \"⊕\" exp 2 | exp \"+\" exp 2 | exp \"+\" exp 3 | exp \"+\" exp 3 | exp \"+\" exp 4 | \"number\" 5 | \"Ñùṃéℝô\" \"number\" shift, and go to state 1 \"Ñùṃéℝô\" shift, and go to state 2 exp go to state 7

State 6

1 exp exp \"⊕\" exp 1 | exp \"⊕\" exp 2 | exp \"+\" exp 3 | exp \"+\" exp 4 | \"number\" 5 | \"Ñùṃéℝô\" \"number\" shift, and go to state 1 \"Ñùṃéℝô\" shift, and go to state 2 exp go to state 8

State 7

1 expexp \"⊕\" exp 2 | exp \"+\" exp 2 | exp \"+\" exp [\$end, \"+\", \"⊕\"] 3 | exp \"+\" exp 3 | exp \"+\" exp [\$end, \"+\", \"⊕\"] \"⊕\" shift, and go to state 6 \$end reduce using rule 2 (exp) \$end [reduce using rule 3 (exp)] \"+\" reduce using rule 2 (exp) \"+\" [reduce using rule 3 (exp)] \"⊕\" [reduce using rule 2 (exp)] \"⊕\" [reduce using rule 3 (exp)] \$default reduce using rule 2 (exp) Conflict between rule 2 and token \"+\" resolved as reduce (%left \"+\").

State 8

1 expexp \"⊕\" exp 1 | exp \"⊕\" exp [\$end, \"+\", \"⊕\"] 2 | exp \"+\" exp 3 | exp \"+\" exp \"+\" shift, and go to state 5 \"⊕\" shift, and go to state 6 \"+\" [reduce using rule 1 (exp)] \"⊕\" [reduce using rule 1 (exp)] \$default reduce using rule 1 (exp)


This document was generated using GNU Bison 3.8.2 XML Automaton Report.
Verbatim copying and distribution of this entire page is permitted in any medium, provided this notice is preserved.
" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/report.at:3768" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_203 #AT_START_204 at_fn_group_banner 204 'conflicts.at:28' \ "Token declaration order" " " 10 at_xfail=no ( printf "%s\n" "204. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token A B C %token D %right E F G %right H I %right J %left K %left L M N %nonassoc O P Q %precedence R S T U %precedence V W %% exp: A %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { assert (A < B); assert (B < C); assert (C < D); assert (D < E); assert (E < F); assert (F < G); assert (G < H); assert (H < I); assert (I < J); assert (J < K); assert (K < L); assert (L < M); assert (M < N); assert (N < O); assert (O < P); assert (P < Q); assert (Q < R); assert (R < S); assert (S < T); assert (T < U); assert (U < V); assert (V < W); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:81: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:81" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:81" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:81: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:81" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:81" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:81: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:81" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:81" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:81: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:81" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:81" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:81: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:81" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:81" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:81: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:81" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:81" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:82" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:82" { set +x printf "%s\n" "$at_srcdir/conflicts.at:82: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:82" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:82" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:84: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:84" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:84" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:84: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:84" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:84" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_204 #AT_START_205 at_fn_group_banner 205 'conflicts.at:101' \ "Token declaration order: literals vs. identifiers" "" 10 at_xfail=no ( printf "%s\n" "205. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %token 'a' 'b' C D %token E F 'g' 'h' %right 'i' 'j' K L %right M N 'o' 'p' %% exp: 'a' | 'b' | C | D | E | F | 'g' | 'h' | 'i' | 'j' | K | L | M | N | 'o' | 'p' ; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:130: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:130" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:130" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:130: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all -o input.c input.y" "conflicts.at:130" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:130" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:130: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:130" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:130" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:130: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:130" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:130" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:130: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:130" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:130" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:130: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:130" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:130" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:131: cat input.output | sed -n '/^State 0\$/,/^State 1\$/p'" at_fn_check_prepare_notrace 'a shell pipeline' "conflicts.at:131" ( $at_check_trace; cat input.output | sed -n '/^State 0$/,/^State 1$/p' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . exp \$end 1 exp: . 'a' 2 | . 'b' 3 | . C 4 | . D 5 | . E 6 | . F 7 | . 'g' 8 | . 'h' 9 | . 'i' 10 | . 'j' 11 | . K 12 | . L 13 | . M 14 | . N 15 | . 'o' 16 | . 'p' 'a' shift, and go to state 1 'b' shift, and go to state 2 C shift, and go to state 3 D shift, and go to state 4 E shift, and go to state 5 F shift, and go to state 6 'g' shift, and go to state 7 'h' shift, and go to state 8 'i' shift, and go to state 9 'j' shift, and go to state 10 K shift, and go to state 11 L shift, and go to state 12 M shift, and go to state 13 N shift, and go to state 14 'o' shift, and go to state 15 'p' shift, and go to state 16 exp go to state 17 State 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:131" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_205 #AT_START_206 at_fn_group_banner 206 'conflicts.at:183' \ "Useless associativity warning" " " 10 at_xfail=no ( printf "%s\n" "206. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token EQ "=" PL "+" ST "*" LP "(" %nonassoc "=" %left "+" %left "*" %precedence "(" %% stmt: exp | "var" "=" exp ; exp: exp "+" exp | exp "*" "num" | "(" exp ")" | "num" ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wprecedence input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wprecedence input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wprecedence input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wprecedence input.y" "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wprecedence input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:205" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:205" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:205" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wprecedence input.y" at_fn_check_prepare_trace "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wprecedence input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-9: warning: useless precedence and associativity for \"=\" [-Wprecedence] input.y:4.1-5: warning: useless associativity for \"*\", use %precedence [-Wprecedence] input.y:5.1-11: warning: useless precedence for \"(\" [-Wprecedence] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y -Werror" "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:2.1-9: warning: useless precedence and associativity for "=" [-Wprecedence] input.y:4.1-5: warning: useless associativity for "*", use %precedence [-Wprecedence] input.y:5.1-11: warning: useless precedence for "(" [-Wprecedence] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:205" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y --warnings=error" "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y -Wnone,none -Werror --trace=none" "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y --warnings=none -Werror --trace=none" "conflicts.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:205" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_206 #AT_START_207 at_fn_group_banner 207 'conflicts.at:218' \ "Useless precedence warning" " " 10 at_xfail=no ( printf "%s\n" "207. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B U V W X Y Z %precedence Z %left X %precedence Y %left W %right V %nonassoc U %% a: b | a U b | f ; b: c | b V c ; c: d | c W d ; d: A | d X d | d Y A ; f: B | f Z B ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wprecedence -fcaret -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wprecedence -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wprecedence -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wprecedence -fcaret -o input.c input.y" "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wprecedence -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:248" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:248" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:248" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence] 7 | %nonassoc U | ^~~~~~~~~ input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence] 6 | %right V | ^~~~~~ input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence] 5 | %left W | ^~~~~ input.y:2.1-11: warning: useless precedence for Z [-Wprecedence] 2 | %precedence Z | ^~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y -Werror" "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence] 7 | %nonassoc U | ^~~~~~~~~ input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence] 6 | %right V | ^~~~~~ input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence] 5 | %left W | ^~~~~ input.y:2.1-11: warning: useless precedence for Z [-Wprecedence] 2 | %precedence Z | ^~~~~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:248" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y --warnings=error" "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:248: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:248" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wprecedence -fcaret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:248" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_207 #AT_START_208 at_fn_group_banner 208 'conflicts.at:275' \ "S/R in initial" " " 10 at_xfail=no ( printf "%s\n" "208. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %expect 1 %% exp: e 'e'; e: 'e' | %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:284" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:284" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:284" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:4.10-15: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:4.10-15: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:284" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:284: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:284" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:284" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:288" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:288" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:288" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:4.10-15: warning: rule useless in parser due to conflicts [-Wother] 4 | e: 'e' | %empty; | ^~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:4.10-15: warning: rule useless in parser due to conflicts [-Wother] 4 | e: 'e' | %empty; | ^~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:288" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:288: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:288" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:288" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_208 #AT_START_209 at_fn_group_banner 209 'conflicts.at:301' \ "%nonassoc and eof" " " 10 at_xfail=no ( printf "%s\n" "209. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include #include /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /* The current argument. */ static const char *input; static int yylex (void) { static size_t toknum; assert (toknum <= strlen (input)); return input[toknum++]; } %} %define parse.error verbose %nonassoc '<' '>' %% expr: expr '<' expr | expr '>' expr | '0' ; %% int main (int argc, const char *argv[]) { input = argc <= 1 ? "" : argv[1]; return yyparse (); } _ATEOF # Expected token list is missing. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:368" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:368" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:368" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:368" { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:368" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$PREPARSER ./input '0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0'" "conflicts.at:368" ( $at_check_trace; $PREPARSER ./input '0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$PREPARSER ./input '0<0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0<0'" "conflicts.at:368" ( $at_check_trace; $PREPARSER ./input '0<0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '<' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$PREPARSER ./input '0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0'" "conflicts.at:368" ( $at_check_trace; $PREPARSER ./input '0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$PREPARSER ./input '0>0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0>0'" "conflicts.at:368" ( $at_check_trace; $PREPARSER ./input '0>0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: \$PREPARSER ./input '0<0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0>0'" "conflicts.at:368" ( $at_check_trace; $PREPARSER ./input '0<0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:368" $at_failed && at_fn_log_failure $at_traceon; } # We must disable default reductions in inconsistent states in order to # have an explicit list of all expected tokens. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dlr.default-reduction=consistent -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dlr.default-reduction=consistent -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.default-reduction=consistent -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.default-reduction=consistent -o input.c input.y" "conflicts.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.default-reduction=consistent -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:372" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:372" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.default-reduction=consistent -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.default-reduction=consistent -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:372" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:372" { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:372" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$PREPARSER ./input '0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0'" "conflicts.at:372" ( $at_check_trace; $PREPARSER ./input '0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$PREPARSER ./input '0<0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0<0'" "conflicts.at:372" ( $at_check_trace; $PREPARSER ./input '0<0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '<', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$PREPARSER ./input '0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0'" "conflicts.at:372" ( $at_check_trace; $PREPARSER ./input '0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$PREPARSER ./input '0>0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0>0'" "conflicts.at:372" ( $at_check_trace; $PREPARSER ./input '0>0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: \$PREPARSER ./input '0<0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0>0'" "conflicts.at:372" ( $at_check_trace; $PREPARSER ./input '0<0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:372: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:372" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:372" $at_failed && at_fn_log_failure $at_traceon; } # lr.default-reduction=consistent happens to work for this test case. # However, for other grammars, lookahead sets can be merged for # different left contexts, so it is still possible to have an incorrect # expected list. Canonical LR is almost a general solution (that is, it # can fail only when %nonassoc is used), so make sure it gives the same # result as above. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dlr.type=canonical-lr -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:381" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dlr.type=canonical-lr -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -o input.c input.y" "conflicts.at:381" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:381" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:381" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:381" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:381" { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:381" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$PREPARSER ./input '0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0'" "conflicts.at:381" ( $at_check_trace; $PREPARSER ./input '0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$PREPARSER ./input '0<0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0<0'" "conflicts.at:381" ( $at_check_trace; $PREPARSER ./input '0<0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '<', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$PREPARSER ./input '0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0'" "conflicts.at:381" ( $at_check_trace; $PREPARSER ./input '0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$PREPARSER ./input '0>0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0>0'" "conflicts.at:381" ( $at_check_trace; $PREPARSER ./input '0>0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: \$PREPARSER ./input '0<0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0>0'" "conflicts.at:381" ( $at_check_trace; $PREPARSER ./input '0<0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:381: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:381" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:381" $at_failed && at_fn_log_failure $at_traceon; } # parse.lac=full is a completely general solution that does not require # any of the above sacrifices. Of course, it does not extend the # language-recognition power of LALR to (IE)LR, but it does ensure that # the reported list of expected tokens matches what the given parser # would have accepted in place of the unexpected token. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.c input.y" "conflicts.at:388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:388" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:388" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:388" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:388" { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:388" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$PREPARSER ./input '0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0'" "conflicts.at:388" ( $at_check_trace; $PREPARSER ./input '0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$PREPARSER ./input '0<0<0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0<0'" "conflicts.at:388" ( $at_check_trace; $PREPARSER ./input '0<0<0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '<', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$PREPARSER ./input '0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0'" "conflicts.at:388" ( $at_check_trace; $PREPARSER ./input '0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$PREPARSER ./input '0>0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0>0>0'" "conflicts.at:388" ( $at_check_trace; $PREPARSER ./input '0>0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: \$PREPARSER ./input '0<0>0'" at_fn_check_prepare_dynamic " $PREPARSER ./input '0<0>0'" "conflicts.at:388" ( $at_check_trace; $PREPARSER ./input '0<0>0' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:388: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:388" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '>', expecting end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:388" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_209 #AT_START_210 at_fn_group_banner 210 'conflicts.at:509' \ "parse.error=verbose and consistent errors: lr.type=ielr" "" 10 at_xfail=no ( printf "%s\n" "210. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type ielr %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:509" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:509" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:509" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:509" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:509" { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:509" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:509" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:509" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_210 #AT_START_211 at_fn_group_banner 211 'conflicts.at:513' \ "parse.error=verbose and consistent errors: lr.type=ielr %glr-parser" "" 10 at_xfail=no ( printf "%s\n" "211. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %define lr.type ielr %glr-parser %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:513" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:513" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:513" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:513" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:513" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:513" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:513" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:513" { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:513" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:513" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:513: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:513" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:513" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_211 #AT_START_212 at_fn_group_banner 212 'conflicts.at:518' \ "parse.error=verbose and consistent errors: lr.type=ielr c++" "" 10 at_xfail=no ( printf "%s\n" "212. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include static int yylex (yy::parser::value_type *lvalp); #define USE(Var) } %header %define lr.type ielr %language "c++" %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } /*-------. | main. | `-------*/ #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:518" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "conflicts.at:518" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:518" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:518" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:518" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "conflicts.at:518" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:518" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:518" { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "conflicts.at:518" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:518" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:518" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_212 #AT_START_213 at_fn_group_banner 213 'conflicts.at:523' \ "parse.error=verbose and consistent errors: lr.type=ielr java" "" 10 at_xfail=no ( printf "%s\n" "213. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code imports { import java.io.IOException; } %define lr.type ielr %language "java" %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %code lexer { /*--------. | yylex. | `--------*/ public String input = "a"; public int index = 0; public int yylex() { if (index < input.length()) return input.charAt(index++); else return 0; } public Object getLVal() { return new Integer(1); } public void yyerror (String m) { System.err.println (m); } }; %% /*-------. | main. | `-------*/ class input { public static void main(String[] args) throws IOException { YYParser p = new YYParser(); boolean success = p.parse(); if (!success) System.exit(1); } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:523" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y" "conflicts.at:523" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:523" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:523" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:523" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y" at_fn_check_prepare_trace "conflicts.at:523" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:523" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:523" printf "%s\n" "conflicts.at:523" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:523" { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: \$SHELL ../../../javacomp.sh input.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh input.java" "conflicts.at:523" ( $at_check_trace; $SHELL ../../../javacomp.sh input.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:523: \$SHELL ../../../javaexec.sh input" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh input" "conflicts.at:523" ( $at_check_trace; $SHELL ../../../javaexec.sh input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:523" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_213 #AT_START_214 at_fn_group_banner 214 'conflicts.at:530' \ "parse.error=verbose and consistent errors: lr.type=ielr lr.default-reduction=consistent" "" 10 at_xfail=no ( printf "%s\n" "214. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type ielr %define lr.default-reduction consistent %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:530" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:530" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:530" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:530" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:530" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:530" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:530" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:530" { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:530" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:530" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'a' or 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:530" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_214 #AT_START_215 at_fn_group_banner 215 'conflicts.at:535' \ "parse.error=verbose and consistent errors: lr.type=ielr lr.default-reduction=accepting" "" 10 at_xfail=no ( printf "%s\n" "215. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type ielr %define lr.default-reduction accepting %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:535" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:535" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:535" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:535" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:535" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:535" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:535" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:535" { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:535" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:535" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:535: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:535" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'a' or 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:535" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_215 #AT_START_216 at_fn_group_banner 216 'conflicts.at:540' \ "parse.error=verbose and consistent errors: lr.type=canonical-lr" "" 10 at_xfail=no ( printf "%s\n" "216. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type canonical-lr %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:540" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:540" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:540" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:540" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:540" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:540" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:540" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:540" { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:540" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:540" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:540: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:540" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'a' or 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:540" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_216 #AT_START_217 at_fn_group_banner 217 'conflicts.at:546' \ "parse.error=verbose and consistent errors: lr.type=canonical-lr parse.lac=full" "" 10 at_xfail=no ( printf "%s\n" "217. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type canonical-lr %define parse.lac full %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:546" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:546" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:546" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:546" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:546" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:546" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:546" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:546" { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:546" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:546" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:546: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:546" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:546" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_217 #AT_START_218 at_fn_group_banner 218 'conflicts.at:551' \ "parse.error=verbose and consistent errors: lr.type=ielr parse.lac=full" "" 10 at_xfail=no ( printf "%s\n" "218. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type ielr %define parse.lac full %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:551" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:551" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:551" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:551" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:551" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:551" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:551" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:551" { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:551" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:551" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:551: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:551" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:551" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_218 #AT_START_219 at_fn_group_banner 219 'conflicts.at:558' \ "parse.error=verbose and consistent errors: c++ lr.type=canonical-lr parse.lac=full" "" 10 at_xfail=no ( printf "%s\n" "219. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include static int yylex (yy::parser::value_type *lvalp); #define USE(Var) } %header %language "c++" %define lr.type canonical-lr %define parse.lac full %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } /*-------. | main. | `-------*/ #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:558" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "conflicts.at:558" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:558" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:558" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:558" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "conflicts.at:558" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:558" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:558" { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "conflicts.at:558" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:558" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:558: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:558" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:558" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_219 #AT_START_220 at_fn_group_banner 220 'conflicts.at:564' \ "parse.error=verbose and consistent errors: c++ lr.type=ielr parse.lac=full" "" 10 at_xfail=no ( printf "%s\n" "220. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include static int yylex (yy::parser::value_type *lvalp); #define USE(Var) } %header %language "c++" %define lr.type ielr %define parse.lac full %define parse.error verbose %% %nonassoc 'a'; start: consistent-error-on-a-a 'a' ; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' | 'a' shift ; default-reduction: %empty ; shift: 'b' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error-on-a-a 'c' ; %% #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } /*-------. | main. | `-------*/ #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:564" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "conflicts.at:564" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:564" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:564" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:564" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "conflicts.at:564" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:564" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:564" { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "conflicts.at:564" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:564" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:564: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:564" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:564" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_220 #AT_START_221 at_fn_group_banner 221 'conflicts.at:622' \ "parse.error=verbose and consistent errors: " " " 10 at_xfail=no ( printf "%s\n" "221. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:622" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:622" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:622" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:622" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:622" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:622" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:622" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:622" { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:622" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:622" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:622: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:622" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:622" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_221 #AT_START_222 at_fn_group_banner 222 'conflicts.at:626' \ "parse.error=verbose and consistent errors: %glr-parser" "" 10 at_xfail=no ( printf "%s\n" "222. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %glr-parser %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:626" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:626" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:626" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:626" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:626" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:626" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:626" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:626" { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:626" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:626" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:626: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:626" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:626" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_222 #AT_START_223 at_fn_group_banner 223 'conflicts.at:632' \ "parse.error=verbose and consistent errors: lr.default-reduction=consistent" "" 10 at_xfail=no ( printf "%s\n" "223. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.default-reduction consistent %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:632" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:632" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:632" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:632" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:632" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:632" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:632" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:632" { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:632" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:632" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:632: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:632" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:632" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_223 #AT_START_224 at_fn_group_banner 224 'conflicts.at:638' \ "parse.error=verbose and consistent errors: lr.default-reduction=accepting" "" 10 at_xfail=no ( printf "%s\n" "224. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.default-reduction accepting %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:638" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:638" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:638" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:638" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:638" { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:638" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:638" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:638: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:638" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:638" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_224 #AT_START_225 at_fn_group_banner 225 'conflicts.at:642' \ "parse.error=verbose and consistent errors: lr.type=canonical-lr" "" 10 at_xfail=no ( printf "%s\n" "225. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define lr.type canonical-lr %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:642" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:642" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:642" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:642" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:642" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:642" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:642" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:642" { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:642" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:642" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:642: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:642" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file, expecting 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:642" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_225 #AT_START_226 at_fn_group_banner 226 'conflicts.at:647' \ "parse.error=verbose and consistent errors: parse.lac=full" "" 10 at_xfail=no ( printf "%s\n" "226. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define parse.lac full %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:647" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:647" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:647" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:647" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:647" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:647" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:647" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:647" { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:647" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:647" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:647: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:647" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:647" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_226 #AT_START_227 at_fn_group_banner 227 'conflicts.at:651' \ "parse.error=verbose and consistent errors: parse.lac=full lr.default-reduction=accepting" "" 10 at_xfail=no ( printf "%s\n" "227. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); #define USE(Var) } %define api.pure %code { #if defined __GNUC__ && 8 <= __GNUC__ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif } %define parse.lac full %define lr.default-reduction accepting %define parse.error verbose %% %nonassoc 'a'; // If $$ = 0 here, then we know that the 'a' destructor is being invoked // incorrectly for the 'b' set in the semantic action below. All 'a' // tokens are returned by yylex, which sets $$ = 1. %destructor { if (!$$) fprintf (stderr, "Wrong destructor.\n"); } 'a'; // Rather than depend on an inconsistent state to induce reading a // lookahead as in the previous grammar, just assign the lookahead in a // semantic action. That lookahead isn't needed before either error // action is encountered. In a previous version of Bison, this was a // problem as it meant yychar was not translated into yytoken before // either error action. The second error action thus invoked a // destructor that it selected according to the incorrect yytoken. The // first error action would have reported an incorrect unexpected token // except that, due to the bug described in the previous grammar, the // unexpected token was not reported at all. start: error-reduce consistent-error 'a' { USE ($3); } ; error-reduce: 'a' 'a' consistent-reduction consistent-error 'a' { USE (($1, $2, $5)); } | 'a' error { USE ($1); } ; consistent-reduction: %empty { assert (yychar == YYEMPTY); yylval = 0; yychar = 'b'; } ; consistent-error: 'a' { USE ($1); } | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error 'b' ; %% #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = 1; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /*-------. | main. | `-------*/ #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:651" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:651" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:651" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:651" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:651" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:651" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "conflicts.at:651" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:651" { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:651" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:651" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:651: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:651" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected end of file " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:651" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_227 #AT_START_228 at_fn_group_banner 228 'conflicts.at:676' \ "LAC: %nonassoc requires splitting canonical LR states" "" 10 at_xfail=no ( printf "%s\n" "228. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.error verbose %nonassoc 'a' %% start: 'a' problem 'a' // First context. | 'b' problem 'b' // Second context. | 'c' reduce-nonassoc // Just makes reduce-nonassoc useful. ; problem: look reduce-nonassoc | look 'a' | look 'b' ; // For the state reached after shifting the 'a' in these productions, // lookahead sets are the same in both the first and second contexts. // Thus, canonical LR reuses the same state for both contexts. However, // the lookahead 'a' for the reduction "look: 'a'" later becomes an // error action only in the first context. In order to immediately // detect the syntax error on 'a' here for only the first context, this // canonical LR state would have to be split into two states, and the // 'a' lookahead would have to be removed from only one of the states. look: 'a' // Reduction lookahead set is always ['a', 'b']. | 'a' 'b' | 'a' 'c' // 'c' is forgotten as an expected token. ; reduce-nonassoc: %prec 'a'; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "aaa"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Show canonical LR's failure. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dlr.type=canonical-lr -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dlr.type=canonical-lr -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -o input.c input.y" "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:726" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:726" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:726" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y -Werror" "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:726" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y --warnings=error" "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:726: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:726" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:726" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:731" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:731" { set +x printf "%s\n" "$at_srcdir/conflicts.at:731: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:731" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:731" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:732: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:732" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:732" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:732: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:732" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting 'b' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:732" $at_failed && at_fn_log_failure $at_traceon; } # It's corrected by LAC. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:737" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:737" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:737" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y -Werror" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:737" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y --warnings=error" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:737: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \\ -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:737" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=canonical-lr -Dparse.lac=full \ -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:737" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:742" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:742" { set +x printf "%s\n" "$at_srcdir/conflicts.at:742: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:742" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:742" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:743: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:743" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:743" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:743: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:743" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting 'b' or 'c' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:743" $at_failed && at_fn_log_failure $at_traceon; } # IELR is sufficient when LAC is used. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dlr.type=ielr -Dparse.lac=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dlr.type=ielr -Dparse.lac=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=ielr -Dparse.lac=full -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=ielr -Dparse.lac=full -o input.c input.y" "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dlr.type=ielr -Dparse.lac=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:748" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:748" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:748" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y -Werror" "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:748" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y --warnings=error" "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:748: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:748" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Dlr.type=ielr -Dparse.lac=full -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:748" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:753" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:753" { set +x printf "%s\n" "$at_srcdir/conflicts.at:753: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:753" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:753" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:754: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:754" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:754" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:754: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:754" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting 'b' or 'c' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:754" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_228 #AT_START_229 at_fn_group_banner 229 'conflicts.at:764' \ "Unresolved SR Conflicts" " " 10 at_xfail=no ( printf "%s\n" "229. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %% exp: exp OP exp | NUM; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c --report=all input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y" "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:774" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:774" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:774" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c --report=all input.y" at_fn_check_prepare_trace "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Werror" "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:774" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=error" "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Wnone,none -Werror --trace=none" "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:774: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=none -Werror --trace=none" "conflicts.at:774" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:774" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # Check the contents of the report. { set +x printf "%s\n" "$at_srcdir/conflicts.at:780: cat input.output" at_fn_check_prepare_trace "conflicts.at:780" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 5 conflicts: 1 shift/reduce Grammar 0 \$accept: exp \$end 1 exp: exp OP exp 2 | NUM Terminals, with rules where they appear \$end (0) 0 error (256) NUM (258) 2 OP (259) 1 Nonterminals, with rules where they appear \$accept (5) on left: 0 exp (6) on left: 1 2 on right: 0 1 State 0 0 \$accept: . exp \$end 1 exp: . exp OP exp 2 | . NUM NUM shift, and go to state 1 exp go to state 2 State 1 2 exp: NUM . \$default reduce using rule 2 (exp) State 2 0 \$accept: exp . \$end 1 exp: exp . OP exp \$end shift, and go to state 3 OP shift, and go to state 4 State 3 0 \$accept: exp \$end . \$default accept State 4 1 exp: . exp OP exp 1 | exp OP . exp 2 | . NUM NUM shift, and go to state 1 exp go to state 5 State 5 1 exp: exp . OP exp 1 | exp OP exp . [\$end, OP] OP shift, and go to state 4 OP [reduce using rule 1 (exp)] \$default reduce using rule 1 (exp) shift/reduce conflict on token OP: 1 exp: exp OP exp . 1 exp: exp . OP exp Example: exp OP exp . OP exp Shift derivation exp \`-> 1: exp OP exp \`-> 1: exp . OP exp Reduce derivation exp \`-> 1: exp OP exp \`-> 1: exp OP exp . " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:780" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_229 #AT_START_230 at_fn_group_banner 230 'conflicts.at:887' \ "Resolved SR Conflicts" " " 10 at_xfail=no ( printf "%s\n" "230. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %left OP %% exp: exp OP exp | NUM; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:898: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c --report=all input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:898" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:898" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:898: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y" "conflicts.at:898" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:898" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:898: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:898" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:898" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:898: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:898" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:898" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:898: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:898" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:898" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:898: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c --report=all input.y" at_fn_check_prepare_trace "conflicts.at:898" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:898" $at_failed && at_fn_log_failure $at_traceon; } # Check the contents of the report. { set +x printf "%s\n" "$at_srcdir/conflicts.at:901: cat input.output" at_fn_check_prepare_trace "conflicts.at:901" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Grammar 0 \$accept: exp \$end 1 exp: exp OP exp 2 | NUM Terminals, with rules where they appear \$end (0) 0 error (256) NUM (258) 2 OP (259) 1 Nonterminals, with rules where they appear \$accept (5) on left: 0 exp (6) on left: 1 2 on right: 0 1 State 0 0 \$accept: . exp \$end 1 exp: . exp OP exp 2 | . NUM NUM shift, and go to state 1 exp go to state 2 State 1 2 exp: NUM . \$default reduce using rule 2 (exp) State 2 0 \$accept: exp . \$end 1 exp: exp . OP exp \$end shift, and go to state 3 OP shift, and go to state 4 State 3 0 \$accept: exp \$end . \$default accept State 4 1 exp: . exp OP exp 1 | exp OP . exp 2 | . NUM NUM shift, and go to state 1 exp go to state 5 State 5 1 exp: exp . OP exp 1 | exp OP exp . [\$end, OP] \$default reduce using rule 1 (exp) Conflict between rule 1 and token OP resolved as reduce (%left OP). " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:901" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_230 #AT_START_231 at_fn_group_banner 231 'conflicts.at:989' \ "%precedence suffices" " " 10 at_xfail=no ( printf "%s\n" "231. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %precedence "then" %precedence "else" %% stmt: "if" cond "then" stmt | "if" cond "then" stmt "else" stmt | "stmt" ; cond: "exp" ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1006: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1006" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1006" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1006: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1006" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1006" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1006: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1006" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1006" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1006: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1006" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1006" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1006: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1006" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1006" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1006: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1006" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1006" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_231 #AT_START_232 at_fn_group_banner 232 'conflicts.at:1015' \ "%precedence does not suffice" " " 10 at_xfail=no ( printf "%s\n" "232. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %precedence "then" %precedence "else" %% stmt: "if" cond "then" stmt | "if" cond "then" stmt "else" stmt | "stmt" ; cond: "exp" | cond "then" cond ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1033" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1033" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1033" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1033" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1033: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:1033" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1033" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_232 #AT_START_233 at_fn_group_banner 233 'conflicts.at:1096' \ "Syntax error in consistent error state: yacc.c" " " 10 at_xfail=no ( printf "%s\n" "233. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %skeleton "yacc.c" %% %nonassoc 'a'; start: 'a' consistent-error-on-a-a 'a'; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' ; default-reduction: %empty; %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "aa"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1096" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:1096" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:1096" { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:1096" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:1096" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_233 #AT_START_234 at_fn_group_banner 234 'conflicts.at:1096' \ "Syntax error in consistent error state: glr.c" " " 10 at_xfail=no ( printf "%s\n" "234. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %skeleton "glr.c" %% %nonassoc 'a'; start: 'a' consistent-error-on-a-a 'a'; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' ; default-reduction: %empty; %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "aa"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1096" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:1096" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:1096" { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "conflicts.at:1096" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:1096" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_234 #AT_START_235 at_fn_group_banner 235 'conflicts.at:1096' \ "Syntax error in consistent error state: lalr1.cc" "" 10 at_xfail=no ( printf "%s\n" "235. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %skeleton "lalr1.cc" %% %nonassoc 'a'; start: 'a' consistent-error-on-a-a 'a'; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' ; default-reduction: %empty; %code { #include static int yylex (yy::parser::value_type *lvalp); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1096" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:1096" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:1096" { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "conflicts.at:1096" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:1096" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_235 #AT_START_236 at_fn_group_banner 236 'conflicts.at:1096' \ "Syntax error in consistent error state: glr.cc" " " 10 at_xfail=no ( printf "%s\n" "236. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %skeleton "glr.cc" %% %nonassoc 'a'; start: 'a' consistent-error-on-a-a 'a'; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' ; default-reduction: %empty; %code { #include static int yylex (yy::parser::value_type *lvalp); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1096" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:1096" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:1096" { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "conflicts.at:1096" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:1096" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_236 #AT_START_237 at_fn_group_banner 237 'conflicts.at:1096' \ "Syntax error in consistent error state: glr2.cc" "" 10 at_xfail=no ( printf "%s\n" "237. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %skeleton "glr2.cc" %% %nonassoc 'a'; start: 'a' consistent-error-on-a-a 'a'; consistent-error-on-a-a: 'a' default-reduction | 'a' default-reduction 'a' ; default-reduction: %empty; %code { #include static int yylex (yy::parser::value_type *lvalp); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "aa"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1096" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother] input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1096" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none" "conflicts.at:1096" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.cc input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "conflicts.at:1096" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:1096" printf "%s\n" "conflicts.at:1096" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/conflicts.at:1096" { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "conflicts.at:1096" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "conflicts.at:1096" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1096: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "conflicts.at:1096" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1096" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_237 #AT_START_238 at_fn_group_banner 238 'conflicts.at:1127' \ "Defaulted Conflicted Reduction" " " 10 at_xfail=no ( printf "%s\n" "238. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: num | id; num: '0'; id : '0'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c --report=all input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y" "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1138" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1138" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1138" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c --report=all input.y" at_fn_check_prepare_trace "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Werror" "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1138" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=error" "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Wnone,none -Werror --trace=none" "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1138: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=none -Werror --trace=none" "conflicts.at:1138" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c --report=all input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1138" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # Check the contents of the report. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1145: cat input.output" at_fn_check_prepare_trace "conflicts.at:1145" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Rules useless in parser due to conflicts 4 id: '0' State 1 conflicts: 1 reduce/reduce Grammar 0 \$accept: exp \$end 1 exp: num 2 | id 3 num: '0' 4 id: '0' Terminals, with rules where they appear \$end (0) 0 '0' (48) 3 4 error (256) Nonterminals, with rules where they appear \$accept (4) on left: 0 exp (5) on left: 1 2 on right: 0 num (6) on left: 3 on right: 1 id (7) on left: 4 on right: 2 State 0 0 \$accept: . exp \$end 1 exp: . num 2 | . id 3 num: . '0' 4 id: . '0' '0' shift, and go to state 1 exp go to state 2 num go to state 3 id go to state 4 State 1 3 num: '0' . [\$end] 4 id: '0' . [\$end] \$end reduce using rule 3 (num) \$end [reduce using rule 4 (id)] \$default reduce using rule 3 (num) reduce/reduce conflict on token \$end: 3 num: '0' . 4 id: '0' . Example: '0' . First reduce derivation exp \`-> 1: num \`-> 3: '0' . Second reduce derivation exp \`-> 2: id \`-> 4: '0' . State 2 0 \$accept: exp . \$end \$end shift, and go to state 5 State 3 1 exp: num . \$default reduce using rule 1 (exp) State 4 2 exp: id . \$default reduce using rule 2 (exp) State 5 0 \$accept: exp \$end . \$default accept " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1145" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_238 #AT_START_239 at_fn_group_banner 239 'conflicts.at:1264' \ "%expect not enough" " " 10 at_xfail=no ( printf "%s\n" "239. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %expect 0 %% exp: exp OP exp | NUM; _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1273: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "conflicts.at:1273" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: error: shift/reduce conflicts: 1 found, 0 expected input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1273" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_239 #AT_START_240 at_fn_group_banner 240 'conflicts.at:1284' \ "%expect right" " " 10 at_xfail=no ( printf "%s\n" "240. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %expect 1 %% exp: exp OP exp | NUM; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1293: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1293" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1293" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1293: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1293" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1293" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1293: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1293" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1293" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1293: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1293" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1293" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1293: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1293" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1293" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1293: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1293" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1293" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_240 #AT_START_241 at_fn_group_banner 241 'conflicts.at:1301' \ "%expect too much" " " 10 at_xfail=no ( printf "%s\n" "241. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %expect 2 %% exp: exp OP exp | NUM; _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "conflicts.at:1310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: error: shift/reduce conflicts: 1 found, 2 expected input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1310" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_241 #AT_START_242 at_fn_group_banner 242 'conflicts.at:1321' \ "%expect with reduce conflicts" " " 10 at_xfail=no ( printf "%s\n" "242. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %expect 0 %% program: a 'a' | a a; a: 'a'; _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "conflicts.at:1330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: error: reduce/reduce conflicts: 1 found, 0 expected input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1330" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_242 #AT_START_243 at_fn_group_banner 243 'conflicts.at:1341' \ "%expect in grammar rule not enough" " " 10 at_xfail=no ( printf "%s\n" "243. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %expect 1 %% exp: exp OP exp %expect 0 | NUM; _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1350: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "conflicts.at:1350" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:4.6-25: error: shift/reduce conflicts for rule 1: 1 found, 0 expected " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1350" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_243 #AT_START_244 at_fn_group_banner 244 'conflicts.at:1360' \ "%expect in grammar rule right" " " 10 at_xfail=no ( printf "%s\n" "244. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %expect 1 %% exp: exp OP exp %expect 1 | NUM; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1369: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1369" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1369: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1369" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1369" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1369: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1369" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1369" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1369" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_244 #AT_START_245 at_fn_group_banner 245 'conflicts.at:1377' \ "%expect in grammar rules" " " 10 at_xfail=no ( printf "%s\n" "245. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %expect 4 %% exp: "number" | exp "+" exp %expect 2 | exp "*" exp %expect 2 _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c -rall input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c -rall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -rall input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -rall input.y" "conflicts.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -rall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1388" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1388: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1388" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1388" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1388: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1388" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1388" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1388: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1388" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1388" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -rall input.y" at_fn_check_prepare_trace "conflicts.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -rall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1388" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_245 #AT_START_246 at_fn_group_banner 246 'conflicts.at:1396' \ "%expect in grammar rule too much" " " 10 at_xfail=no ( printf "%s\n" "246. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token NUM OP %expect 1 %% exp: exp OP exp | NUM %expect 1; _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1405: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y" "conflicts.at:1405" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:4.19-31: error: shift/reduce conflicts for rule 2: 0 found, 1 expected " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1405" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_246 #AT_START_247 at_fn_group_banner 247 'conflicts.at:1415' \ "%expect-rr in grammar rule" " " 10 at_xfail=no ( printf "%s\n" "247. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %glr-parser %expect-rr 3 %% exp : a '1' | a '2' | a '3' | b '1' | b '2' | b '3' a: b: %expect-rr 3 _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1432: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1432" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1432: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1432" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1432" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1432: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1432" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1432" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1432" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_247 #AT_START_248 at_fn_group_banner 248 'conflicts.at:1440' \ "%expect-rr too much in grammar rule" " " 10 at_xfail=no ( printf "%s\n" "248. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %glr-parser %expect-rr 3 %% exp : a '1' | a '2' | a '3' | b '1' | b '2' | b '3' a: b: %expect-rr 4 _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1457: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y" "conflicts.at:1457" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 4 expected 12 | b: %expect-rr 4 | ^~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1457" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_248 #AT_START_249 at_fn_group_banner 249 'conflicts.at:1469' \ "%expect-rr not enough in grammar rule" " " 10 at_xfail=no ( printf "%s\n" "249. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %glr-parser %expect-rr 3 %% exp : a '1' | a '2' | a '3' | b '1' | b '2' | b '3' a: b: %expect-rr 2 _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y" "conflicts.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 2 expected 12 | b: %expect-rr 2 | ^~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1486" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_249 #AT_START_250 at_fn_group_banner 250 'conflicts.at:1498' \ "%prec with user string" " " 10 at_xfail=no ( printf "%s\n" "250. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: "foo" %prec "foo" ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1507: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1507" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1507" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1507: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1507" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1507" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1507: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1507" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1507" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1507: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1507" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1507" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1507: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1507" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1507" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1507: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1507" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1507" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_250 #AT_START_251 at_fn_group_banner 251 'conflicts.at:1515' \ "%no-default-prec without %prec" " " 10 at_xfail=no ( printf "%s\n" "251. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %left '+' %left '*' %% %no-default-prec; e: e '+' e | e '*' e | '0' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall -o input.c input.y" "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1531" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1531" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1531" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence] input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Werror" "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence] input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1531" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=error" "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1531" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_251 #AT_START_252 at_fn_group_banner 252 'conflicts.at:1544' \ "%no-default-prec with %prec" " " 10 at_xfail=no ( printf "%s\n" "252. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %left '+' %left '*' %% %no-default-prec; e: e '+' e %prec '+' | e '*' e %prec '*' | '0' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1560" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1560" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1560" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1560: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1560" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1560: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1560" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1560" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1560: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1560" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1560" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1560" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1560" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_252 #AT_START_253 at_fn_group_banner 253 'conflicts.at:1568' \ "%default-prec" " " 10 at_xfail=no ( printf "%s\n" "253. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %left '+' %left '*' %% %default-prec; e: e '+' e | e '*' e | '0' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1584: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1584" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1584" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1584: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "conflicts.at:1584" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1584" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1584: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1584" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1584" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1584: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1584" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1584" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1584: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1584" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1584" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1584: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1584" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1584" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_253 #AT_START_254 at_fn_group_banner 254 'conflicts.at:1592' \ "Unreachable States After Conflict Resolution" " " 10 at_xfail=no ( printf "%s\n" "254. $at_setup_line: testing $at_desc ..." $at_traceon # If conflict resolution makes states unreachable, remove those states, report # rules that are then unused, and don't report conflicts in those states. Test # what happens when a nonterminal becomes useless as a result of state removal # since that causes lalr.o's goto map to be rewritten. cat >input.y <<'_ATEOF' %output "input.c" %left 'a' %% start: resolved_conflict 'a' reported_conflicts 'a' ; /* S/R conflict resolved as reduce, so the state with item * (resolved_conflict: 'a' . unreachable1) and all it transition successors are * unreachable, and the associated production is useless. */ resolved_conflict: 'a' unreachable1 | %prec 'a' ; /* S/R conflict that need not be reported since it is unreachable because of * the previous conflict resolution. Nonterminal unreachable1 and all its * productions are useless. */ unreachable1: 'a' unreachable2 | ; /* Likewise for a R/R conflict and nonterminal unreachable2. */ unreachable2: | ; /* Make sure remaining S/R and R/R conflicts are still reported correctly even * when their states are renumbered due to state removal. */ reported_conflicts: 'a' | 'a' | ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all input.y" "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1638" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1638" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1638" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all input.y" at_fn_check_prepare_trace "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother] input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother] input.y:21.4: warning: rule useless in parser due to conflicts [-Wother] input.y:25.14: warning: rule useless in parser due to conflicts [-Wother] input.y:25.16: warning: rule useless in parser due to conflicts [-Wother] input.y:31.5-7: warning: rule useless in parser due to conflicts [-Wother] input.y:32.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y -Werror" "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother] input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother] input.y:21.4: warning: rule useless in parser due to conflicts [-Wother] input.y:25.14: warning: rule useless in parser due to conflicts [-Wother] input.y:25.16: warning: rule useless in parser due to conflicts [-Wother] input.y:31.5-7: warning: rule useless in parser due to conflicts [-Wother] input.y:32.4: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1638" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y --warnings=error" "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y -Wnone,none -Werror --trace=none" "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1638: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y --warnings=none -Werror --trace=none" "conflicts.at:1638" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1638" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1651: cat input.output" at_fn_check_prepare_trace "conflicts.at:1651" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Rules useless in parser due to conflicts 2 resolved_conflict: 'a' unreachable1 4 unreachable1: 'a' unreachable2 5 | %empty 6 unreachable2: %empty 7 | %empty 9 reported_conflicts: 'a' 10 | %empty State 4 conflicts: 1 shift/reduce State 5 conflicts: 1 reduce/reduce Grammar 0 \$accept: start \$end 1 start: resolved_conflict 'a' reported_conflicts 'a' 2 resolved_conflict: 'a' unreachable1 3 | %empty 4 unreachable1: 'a' unreachable2 5 | %empty 6 unreachable2: %empty 7 | %empty 8 reported_conflicts: 'a' 9 | 'a' 10 | %empty Terminals, with rules where they appear \$end (0) 0 'a' (97) 1 2 4 8 9 error (256) Nonterminals, with rules where they appear \$accept (4) on left: 0 start (5) on left: 1 on right: 0 resolved_conflict (6) on left: 2 3 on right: 1 unreachable1 (7) on left: 4 5 on right: 2 unreachable2 (8) on left: 6 7 on right: 4 reported_conflicts (9) on left: 8 9 10 on right: 1 State 0 0 \$accept: . start \$end 1 start: . resolved_conflict 'a' reported_conflicts 'a' 2 resolved_conflict: . 'a' unreachable1 3 | %empty . ['a'] \$default reduce using rule 3 (resolved_conflict) start go to state 1 resolved_conflict go to state 2 Conflict between rule 3 and token 'a' resolved as reduce (%left 'a'). State 1 0 \$accept: start . \$end \$end shift, and go to state 3 State 2 1 start: resolved_conflict . 'a' reported_conflicts 'a' 'a' shift, and go to state 4 State 3 0 \$accept: start \$end . \$default accept State 4 1 start: resolved_conflict 'a' . reported_conflicts 'a' 8 reported_conflicts: . 'a' 9 | . 'a' 10 | %empty . ['a'] 'a' shift, and go to state 5 'a' [reduce using rule 10 (reported_conflicts)] reported_conflicts go to state 6 shift/reduce conflict on token 'a': 10 reported_conflicts: %empty . 8 reported_conflicts: . 'a' First example: resolved_conflict . 'a' 'a' Shift derivation start \`-> 1: resolved_conflict reported_conflicts 'a' \`-> 8: . 'a' Second example: resolved_conflict . 'a' Reduce derivation start \`-> 1: resolved_conflict reported_conflicts 'a' \`-> 10: %empty . shift/reduce conflict on token 'a': 10 reported_conflicts: %empty . 9 reported_conflicts: . 'a' First example: resolved_conflict . 'a' 'a' Shift derivation start \`-> 1: resolved_conflict reported_conflicts 'a' \`-> 9: . 'a' Second example: resolved_conflict . 'a' Reduce derivation start \`-> 1: resolved_conflict reported_conflicts 'a' \`-> 10: %empty . State 5 8 reported_conflicts: 'a' . ['a'] 9 | 'a' . ['a'] 'a' reduce using rule 8 (reported_conflicts) 'a' [reduce using rule 9 (reported_conflicts)] \$default reduce using rule 8 (reported_conflicts) reduce/reduce conflict on token 'a': 8 reported_conflicts: 'a' . 9 reported_conflicts: 'a' . Example: 'a' . First reduce derivation reported_conflicts \`-> 8: 'a' . Second reduce derivation reported_conflicts \`-> 9: 'a' . State 6 1 start: resolved_conflict 'a' reported_conflicts . 'a' 'a' shift, and go to state 7 State 7 1 start: resolved_conflict 'a' reported_conflicts 'a' . \$default reduce using rule 1 (start) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1651" $at_failed && at_fn_log_failure $at_traceon; } cat >input-keep.y <<'_ATEOF' %define lr.keep-unreachable-state _ATEOF { set +x printf "%s\n" "$at_srcdir/conflicts.at:1836: cat input.y >> input-keep.y" at_fn_check_prepare_trace "conflicts.at:1836" ( $at_check_trace; cat input.y >> input-keep.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1836" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv input-keep.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv input-keep.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input-keep.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input-keep.y" "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml input-keep.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1838" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1838" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1838" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input-keep.y" at_fn_check_prepare_trace "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret input-keep.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] input-keep.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother] input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother] input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother] input-keep.y:33.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y -Werror" "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] input-keep.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother] input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother] input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother] input-keep.y:33.4: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1838" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y --warnings=error" "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y -Wnone,none -Werror --trace=none" "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1838: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y --warnings=none -Werror --trace=none" "conflicts.at:1838" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input-keep.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1838" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_254 #AT_START_255 at_fn_group_banner 255 'conflicts.at:1855' \ "Solved conflicts report for multiple reductions in a state" "" 10 at_xfail=no ( printf "%s\n" "255. $at_setup_line: testing $at_desc ..." $at_traceon # Used to lose earlier solved conflict messages even within a single S/R/R. cat >input.y <<'_ATEOF' %left 'a' %right 'b' %right 'c' %right 'd' %% start: 'a' | empty_a 'a' | 'b' | empty_b 'b' | 'c' | empty_c1 'c' | empty_c2 'c' | empty_c3 'c' ; empty_a: %empty %prec 'a' ; empty_b: %empty %prec 'b' ; empty_c1: %empty %prec 'c' ; empty_c2: %empty %prec 'c' ; empty_c3: %empty %prec 'd' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1881: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1881" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1881" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1881: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all -o input.c input.y" "conflicts.at:1881" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1881" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1881: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1881" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1881" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1881: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1881" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1881" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1881: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1881" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1881" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1881: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1881" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1881" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1882: cat input.output | sed -n '/^State 0\$/,/^State 1\$/p'" at_fn_check_prepare_notrace 'a shell pipeline' "conflicts.at:1882" ( $at_check_trace; cat input.output | sed -n '/^State 0$/,/^State 1$/p' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . start \$end 1 start: . 'a' 2 | . empty_a 'a' 3 | . 'b' 4 | . empty_b 'b' 5 | . 'c' 6 | . empty_c1 'c' 7 | . empty_c2 'c' 8 | . empty_c3 'c' 9 empty_a: %empty . ['a'] 10 empty_b: %empty . [] 11 empty_c1: %empty . [] 12 empty_c2: %empty . [] 13 empty_c3: %empty . ['c'] 'b' shift, and go to state 1 'c' reduce using rule 13 (empty_c3) \$default reduce using rule 9 (empty_a) start go to state 2 empty_a go to state 3 empty_b go to state 4 empty_c1 go to state 5 empty_c2 go to state 6 empty_c3 go to state 7 Conflict between rule 9 and token 'a' resolved as reduce (%left 'a'). Conflict between rule 10 and token 'b' resolved as shift (%right 'b'). Conflict between rule 11 and token 'c' resolved as shift (%right 'c'). Conflict between rule 12 and token 'c' resolved as shift (%right 'c'). Conflict between rule 13 and token 'c' resolved as reduce ('c' < 'd'). State 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1882" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_255 #AT_START_256 at_fn_group_banner 256 'conflicts.at:1935' \ "%nonassoc error actions for multiple reductions in a state" "" 10 at_xfail=no ( printf "%s\n" "256. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %nonassoc 'a' 'b' 'c' %% start: 'a' | empty_a 'a' | 'b' | empty_b 'b' | 'c' | empty_c1 'c' | empty_c2 'c' | empty_c3 'c' ; empty_a: %prec 'a' ; empty_b: %prec 'b' ; empty_c1: %prec 'c' ; empty_c2: %prec 'c' ; empty_c3: %prec 'c' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --trace=cex -fcaret --report=all -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --trace=cex -fcaret --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=cex -fcaret --report=all -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=cex -fcaret --report=all -o input.c input.y" "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --trace=cex -fcaret --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1959" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:1959" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:1959" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y" at_fn_check_prepare_trace "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "bison (GNU Bison) 3.8.2 init: 0.000000 # state items: 26 State 0: 0 \$accept: . start \$end -> 0 \$accept: start . \$end => 2 start: . empty_a 'a' => 4 start: . empty_b 'b' => 6 start: . empty_c1 'c' => 7 start: . empty_c2 'c' => 8 start: . empty_c3 'c' 1 start: . 'a' DISABLED 2 start: . empty_a 'a' -> 2 start: empty_a . 'a' => 9 empty_a: %empty . <- 0 \$accept: . start \$end 3 start: . 'b' DISABLED 4 start: . empty_b 'b' -> 4 start: empty_b . 'b' => 10 empty_b: %empty . <- 0 \$accept: . start \$end 5 start: . 'c' DISABLED 6 start: . empty_c1 'c' -> 6 start: empty_c1 . 'c' => 11 empty_c1: %empty . <- 0 \$accept: . start \$end 7 start: . empty_c2 'c' -> 7 start: empty_c2 . 'c' => 12 empty_c2: %empty . <- 0 \$accept: . start \$end 8 start: . empty_c3 'c' -> 8 start: empty_c3 . 'c' => 13 empty_c3: %empty . <- 0 \$accept: . start \$end 9 empty_a: %empty . <- 2 start: . empty_a 'a' 10 empty_b: %empty . <- 4 start: . empty_b 'b' 11 empty_c1: %empty . <- 6 start: . empty_c1 'c' 12 empty_c2: %empty . <- 7 start: . empty_c2 'c' 13 empty_c3: %empty . <- 8 start: . empty_c3 'c' State 1: 0 \$accept: start . \$end -> 0 \$accept: start \$end . <- 0 \$accept: . start \$end State 2: 2 start: empty_a . 'a' -> 2 start: empty_a 'a' . <- 2 start: . empty_a 'a' State 3: 4 start: empty_b . 'b' -> 4 start: empty_b 'b' . <- 4 start: . empty_b 'b' State 4: 6 start: empty_c1 . 'c' -> 6 start: empty_c1 'c' . <- 6 start: . empty_c1 'c' State 5: 7 start: empty_c2 . 'c' -> 7 start: empty_c2 'c' . <- 7 start: . empty_c2 'c' State 6: 8 start: empty_c3 . 'c' -> 8 start: empty_c3 'c' . <- 8 start: . empty_c3 'c' State 7: 0 \$accept: start \$end . <- 0 \$accept: start . \$end State 8: 2 start: empty_a 'a' . <- 2 start: empty_a . 'a' State 9: 4 start: empty_b 'b' . <- 4 start: empty_b . 'b' State 10: 6 start: empty_c1 'c' . <- 6 start: empty_c1 . 'c' State 11: 7 start: empty_c2 'c' . <- 7 start: empty_c2 . 'c' State 12: 8 start: empty_c3 'c' . <- 8 start: empty_c3 . 'c' FIRSTS \$accept firsts 'a' 'b' 'c' start firsts 'a' 'b' 'c' empty_a firsts empty_b firsts empty_c1 firsts empty_c2 firsts empty_c3 firsts input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:4.5-7: warning: rule useless in parser due to conflicts [-Wother] 4 | 'a' | ^~~ input.y:6.5-7: warning: rule useless in parser due to conflicts [-Wother] 6 | | 'b' | ^~~ input.y:8.5-7: warning: rule useless in parser due to conflicts [-Wother] 8 | | 'c' | ^~~ input.y:13.10-18: warning: rule useless in parser due to conflicts [-Wother] 13 | empty_a: %prec 'a' ; | ^~~~~~~~~ input.y:14.10-18: warning: rule useless in parser due to conflicts [-Wother] 14 | empty_b: %prec 'b' ; | ^~~~~~~~~ input.y:15.11-19: warning: rule useless in parser due to conflicts [-Wother] 15 | empty_c1: %prec 'c' ; | ^~~~~~~~~ input.y:16.11-19: warning: rule useless in parser due to conflicts [-Wother] 16 | empty_c2: %prec 'c' ; | ^~~~~~~~~ input.y:17.11-19: warning: rule useless in parser due to conflicts [-Wother] 17 | empty_c3: %prec 'c' ; | ^~~~~~~~~ REDUCE ITEM PATH: 0 \$accept: . start \$end 7 start: . empty_c2 'c' 12 empty_c2: %empty . CONFLICT 1 (size 1 depth 0 rc 2) 12 empty_c2: %empty . 12 empty_c2: %empty . . CONFLICT 2 (size 1 depth 0 rc 2) 13 empty_c3: %empty . 13 empty_c3: %empty . . CONFLICT 1 (size 2 depth -1 rc 4) 7 start: . empty_c2 'c' 7 start: empty_c2 . 'c' empty_c2 \`-> 12: %empty . CONFLICT 2 (size 1 depth 0 rc 3) 13 empty_c3: %empty . 13 empty_c3: %empty . . CONFLICT 1 (size 1 depth 0 rc 3) 12 empty_c2: %empty . 12 empty_c2: %empty . . CONFLICT 2 (size 2 depth -1 rc 2) 8 start: . empty_c3 'c' 8 start: empty_c3 . 'c' empty_c3 \`-> 13: %empty . CONFLICT 1 (size 2 depth -1 rc 3) 7 start: . empty_c2 'c' 7 start: empty_c2 . 'c' empty_c2 \`-> 12: %empty . CONFLICT 2 (size 2 depth -1 rc 2) 8 start: . empty_c3 'c' 8 start: empty_c3 . 'c' empty_c3 \`-> 13: %empty . CONFLICT 1 (size 3 depth -1 rc 2) 7 start: . empty_c2 'c' 7 start: empty_c2 'c' . empty_c2 \`-> 12: %empty . CONFLICT 2 (size 3 depth -1 rc 2) 8 start: . empty_c3 'c' 8 start: empty_c3 'c' . empty_c3 \`-> 13: %empty . CONFLICT 1 (size 2 depth -1 rc 4) 0 \$accept: . start \$end 0 \$accept: start . \$end start \`-> 7: empty_c2 'c' \`-> 12: %empty . CONFLICT 2 (size 3 depth -1 rc 3) 8 start: . empty_c3 'c' 8 start: empty_c3 'c' . empty_c3 \`-> 13: %empty . CONFLICT 1 (size 3 depth -1 rc 3) 7 start: . empty_c2 'c' 7 start: empty_c2 'c' . empty_c2 \`-> 12: %empty . CONFLICT 2 (size 2 depth -1 rc 2) 0 \$accept: . start \$end 0 \$accept: start . \$end start \`-> 8: empty_c3 'c' \`-> 13: %empty . CONFLICT 1 (size 2 depth -1 rc 3) 0 \$accept: . start \$end 0 \$accept: start . \$end start \`-> 7: empty_c2 'c' \`-> 12: %empty . CONFLICT 2 (size 2 depth -1 rc 2) 0 \$accept: . start \$end 0 \$accept: start . \$end start \`-> 8: empty_c3 'c' \`-> 13: %empty . " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y -Werror" "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' bison (GNU Bison) 3.8.2 init: 0.000000 # state items: 26 State 0: 0 $accept: . start $end -> 0 $accept: start . $end => 2 start: . empty_a 'a' => 4 start: . empty_b 'b' => 6 start: . empty_c1 'c' => 7 start: . empty_c2 'c' => 8 start: . empty_c3 'c' 1 start: . 'a' DISABLED 2 start: . empty_a 'a' -> 2 start: empty_a . 'a' => 9 empty_a: %empty . <- 0 $accept: . start $end 3 start: . 'b' DISABLED 4 start: . empty_b 'b' -> 4 start: empty_b . 'b' => 10 empty_b: %empty . <- 0 $accept: . start $end 5 start: . 'c' DISABLED 6 start: . empty_c1 'c' -> 6 start: empty_c1 . 'c' => 11 empty_c1: %empty . <- 0 $accept: . start $end 7 start: . empty_c2 'c' -> 7 start: empty_c2 . 'c' => 12 empty_c2: %empty . <- 0 $accept: . start $end 8 start: . empty_c3 'c' -> 8 start: empty_c3 . 'c' => 13 empty_c3: %empty . <- 0 $accept: . start $end 9 empty_a: %empty . <- 2 start: . empty_a 'a' 10 empty_b: %empty . <- 4 start: . empty_b 'b' 11 empty_c1: %empty . <- 6 start: . empty_c1 'c' 12 empty_c2: %empty . <- 7 start: . empty_c2 'c' 13 empty_c3: %empty . <- 8 start: . empty_c3 'c' State 1: 0 $accept: start . $end -> 0 $accept: start $end . <- 0 $accept: . start $end State 2: 2 start: empty_a . 'a' -> 2 start: empty_a 'a' . <- 2 start: . empty_a 'a' State 3: 4 start: empty_b . 'b' -> 4 start: empty_b 'b' . <- 4 start: . empty_b 'b' State 4: 6 start: empty_c1 . 'c' -> 6 start: empty_c1 'c' . <- 6 start: . empty_c1 'c' State 5: 7 start: empty_c2 . 'c' -> 7 start: empty_c2 'c' . <- 7 start: . empty_c2 'c' State 6: 8 start: empty_c3 . 'c' -> 8 start: empty_c3 'c' . <- 8 start: . empty_c3 'c' State 7: 0 $accept: start $end . <- 0 $accept: start . $end State 8: 2 start: empty_a 'a' . <- 2 start: empty_a . 'a' State 9: 4 start: empty_b 'b' . <- 4 start: empty_b . 'b' State 10: 6 start: empty_c1 'c' . <- 6 start: empty_c1 . 'c' State 11: 7 start: empty_c2 'c' . <- 7 start: empty_c2 . 'c' State 12: 8 start: empty_c3 'c' . <- 8 start: empty_c3 . 'c' FIRSTS $accept firsts 'a' 'b' 'c' start firsts 'a' 'b' 'c' empty_a firsts empty_b firsts empty_c1 firsts empty_c2 firsts empty_c3 firsts input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:4.5-7: warning: rule useless in parser due to conflicts [-Wother] 4 | 'a' | ^~~ input.y:6.5-7: warning: rule useless in parser due to conflicts [-Wother] 6 | | 'b' | ^~~ input.y:8.5-7: warning: rule useless in parser due to conflicts [-Wother] 8 | | 'c' | ^~~ input.y:13.10-18: warning: rule useless in parser due to conflicts [-Wother] 13 | empty_a: %prec 'a' ; | ^~~~~~~~~ input.y:14.10-18: warning: rule useless in parser due to conflicts [-Wother] 14 | empty_b: %prec 'b' ; | ^~~~~~~~~ input.y:15.11-19: warning: rule useless in parser due to conflicts [-Wother] 15 | empty_c1: %prec 'c' ; | ^~~~~~~~~ input.y:16.11-19: warning: rule useless in parser due to conflicts [-Wother] 16 | empty_c2: %prec 'c' ; | ^~~~~~~~~ input.y:17.11-19: warning: rule useless in parser due to conflicts [-Wother] 17 | empty_c3: %prec 'c' ; | ^~~~~~~~~ REDUCE ITEM PATH: 0 $accept: . start $end 7 start: . empty_c2 'c' 12 empty_c2: %empty . CONFLICT 1 (size 1 depth 0 rc 2) 12 empty_c2: %empty . 12 empty_c2: %empty . . CONFLICT 2 (size 1 depth 0 rc 2) 13 empty_c3: %empty . 13 empty_c3: %empty . . CONFLICT 1 (size 2 depth -1 rc 4) 7 start: . empty_c2 'c' 7 start: empty_c2 . 'c' empty_c2 `-> 12: %empty . CONFLICT 2 (size 1 depth 0 rc 3) 13 empty_c3: %empty . 13 empty_c3: %empty . . CONFLICT 1 (size 1 depth 0 rc 3) 12 empty_c2: %empty . 12 empty_c2: %empty . . CONFLICT 2 (size 2 depth -1 rc 2) 8 start: . empty_c3 'c' 8 start: empty_c3 . 'c' empty_c3 `-> 13: %empty . CONFLICT 1 (size 2 depth -1 rc 3) 7 start: . empty_c2 'c' 7 start: empty_c2 . 'c' empty_c2 `-> 12: %empty . CONFLICT 2 (size 2 depth -1 rc 2) 8 start: . empty_c3 'c' 8 start: empty_c3 . 'c' empty_c3 `-> 13: %empty . CONFLICT 1 (size 3 depth -1 rc 2) 7 start: . empty_c2 'c' 7 start: empty_c2 'c' . empty_c2 `-> 12: %empty . CONFLICT 2 (size 3 depth -1 rc 2) 8 start: . empty_c3 'c' 8 start: empty_c3 'c' . empty_c3 `-> 13: %empty . CONFLICT 1 (size 2 depth -1 rc 4) 0 $accept: . start $end 0 $accept: start . $end start `-> 7: empty_c2 'c' `-> 12: %empty . CONFLICT 2 (size 3 depth -1 rc 3) 8 start: . empty_c3 'c' 8 start: empty_c3 'c' . empty_c3 `-> 13: %empty . CONFLICT 1 (size 3 depth -1 rc 3) 7 start: . empty_c2 'c' 7 start: empty_c2 'c' . empty_c2 `-> 12: %empty . CONFLICT 2 (size 2 depth -1 rc 2) 0 $accept: . start $end 0 $accept: start . $end start `-> 8: empty_c3 'c' `-> 13: %empty . CONFLICT 1 (size 2 depth -1 rc 3) 0 $accept: . start $end 0 $accept: start . $end start `-> 7: empty_c2 'c' `-> 12: %empty . CONFLICT 2 (size 2 depth -1 rc 2) 0 $accept: . start $end 0 $accept: start . $end start `-> 8: empty_c3 'c' `-> 13: %empty . _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:1959" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y --warnings=error" "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y -Wnone,none -Werror --trace=none" "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:1959: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y --warnings=none -Werror --trace=none" "conflicts.at:1959" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --trace=cex -fcaret --report=all -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:1959" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2239: cat input.output | sed -n '/^State 0\$/,/^State 1\$/p'" at_fn_check_prepare_notrace 'a shell pipeline' "conflicts.at:2239" ( $at_check_trace; cat input.output | sed -n '/^State 0$/,/^State 1$/p' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 0 0 \$accept: . start \$end 1 start: . 'a' 2 | . empty_a 'a' 3 | . 'b' 4 | . empty_b 'b' 5 | . 'c' 6 | . empty_c1 'c' 7 | . empty_c2 'c' 8 | . empty_c3 'c' 9 empty_a: %empty . [] 10 empty_b: %empty . [] 11 empty_c1: %empty . [] 12 empty_c2: %empty . ['c'] 13 empty_c3: %empty . ['c'] 'a' error (nonassociative) 'b' error (nonassociative) 'c' error (nonassociative) 'c' [reduce using rule 12 (empty_c2)] 'c' [reduce using rule 13 (empty_c3)] start go to state 1 empty_a go to state 2 empty_b go to state 3 empty_c1 go to state 4 empty_c2 go to state 5 empty_c3 go to state 6 Conflict between rule 9 and token 'a' resolved as an error (%nonassoc 'a'). Conflict between rule 10 and token 'b' resolved as an error (%nonassoc 'b'). Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c'). reduce/reduce conflict on token 'c': 12 empty_c2: %empty . 13 empty_c3: %empty . Example: . 'c' First reduce derivation start \`-> 7: empty_c2 'c' \`-> 12: %empty . Second reduce derivation start \`-> 8: empty_c3 'c' \`-> 13: %empty . State 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2239" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_256 #AT_START_257 at_fn_group_banner 257 'conflicts.at:2299' \ "%expect-rr non GLR" " " 10 at_xfail=no ( printf "%s\n" "257. $at_setup_line: testing $at_desc ..." $at_traceon cat >1.y <<'_ATEOF' %expect-rr 0 %% exp: 'a' _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv 1.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv 1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml 1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml 1.y" "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml 1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2307" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2307" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2307" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret 1.y" at_fn_check_prepare_trace "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret 1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.y: warning: %expect-rr applies only to GLR parsers [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y -Werror" "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' 1.y: warning: %expect-rr applies only to GLR parsers [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:2307" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y --warnings=error" "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y -Wnone,none -Werror --trace=none" "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2307: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y --warnings=none -Werror --trace=none" "conflicts.at:2307" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 1.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2307" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >2.y <<'_ATEOF' %expect-rr 1 %% exp: 'a' | 'a'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv 2.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml 2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml 2.y" "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2317" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2317" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2317" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret 2.y" at_fn_check_prepare_trace "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "2.y: warning: %expect-rr applies only to GLR parsers [-Wother] 2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] 2.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples 2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y -Werror" "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' 2.y: warning: %expect-rr applies only to GLR parsers [-Wother] 2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] 2.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples 2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:2317" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y --warnings=error" "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y -Wnone,none -Werror --trace=none" "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y --warnings=none -Werror --trace=none" "conflicts.at:2317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret 2.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2317" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_257 #AT_START_258 at_fn_group_banner 258 'conflicts.at:2331' \ "-W versus %expect and %expect-rr" " " 10 at_xfail=no ( printf "%s\n" "258. $at_setup_line: testing $at_desc ..." $at_traceon cat >sr-rr.y <<'_ATEOF' %glr-parser %% start: 'a' | A 'a' | B 'a' ; A: ; B: ; _ATEOF cat >sr.y <<'_ATEOF' %glr-parser %% start: 'a' | A 'a' ; A: ; _ATEOF cat >rr.y <<'_ATEOF' %glr-parser %% start: A | B ; A: ; B: ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv sr-rr.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml sr-rr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml sr-rr.y" "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2354" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2354" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2354" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret sr-rr.y" at_fn_check_prepare_trace "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y -Werror" "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:2354" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y --warnings=error" "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y -Wnone,none -Werror --trace=none" "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y --warnings=none -Werror --trace=none" "conflicts.at:2354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret sr-rr.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2354" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-conflicts-sr sr-rr.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-conflicts-sr sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-conflicts-sr sr-rr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-conflicts-sr sr-rr.y" "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-conflicts-sr sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2359" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2359" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2359" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y" at_fn_check_prepare_trace "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y -Werror" "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' sr-rr.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] sr-rr.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:2359" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y --warnings=error" "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y -Wnone,none -Werror --trace=none" "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2359: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y --warnings=none -Werror --trace=none" "conflicts.at:2359" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-sr sr-rr.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2359" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-conflicts-rr sr-rr.y" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-conflicts-rr sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-conflicts-rr sr-rr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-conflicts-rr sr-rr.y" "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-conflicts-rr sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2363" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y" at_fn_check_prepare_trace "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y -Werror" "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' sr-rr.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "conflicts.at:2363" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y --warnings=error" "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y -Wnone,none -Werror --trace=none" "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y --warnings=none -Werror --trace=none" "conflicts.at:2363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wno-conflicts-rr sr-rr.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2363" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # This is piece of code is rather complex for a simple task: try every # combination of (0 or 1 real SR) x (0 or 1 real RR) x (don't %expect # or %expect 0, 1, or 2 SR) x (don't %expect-rr or %expect-rr 0, 1, or 2 # RR). # Number and types of genuine conflicts in the grammar. for gram in sr-rr sr rr; do # Number of expected s/r conflicts. for sr_exp_i in '' 0 1 2; do # Number of expected r/r conflicts. for rr_exp_i in '' 0 1 2; do test -z "$sr_exp_i" && test -z "$rr_exp_i" && continue # Build grammar file. sr_exp=0 rr_exp=0 file=$gram directives= if test -n "$sr_exp_i"; then sr_exp=$sr_exp_i file=$file-expect-$sr_exp directives="%expect $sr_exp" fi if test -n "$rr_exp_i"; then rr_exp=$rr_exp_i file=$file-expect-rr-$rr_exp directives="$directives %expect-rr $rr_exp" fi file=$file.y echo "$directives" > $file cat $gram.y >> $file # Number of found conflicts. case $gram in (sr) sr_count=1; rr_count=0;; (rr) sr_count=0; rr_count=1;; (sr-rr) sr_count=1; rr_count=1;; esac # Update number of expected conflicts: if %expect is given then # %expect-rr defaults to 0, and vice-versa. Leave empty if # nothing expected. case $sr_exp_i:$rr_exp_i in ?:) rr_exp_i=0;; :?) sr_exp_i=0;; esac # Run tests. if test $sr_count -eq $sr_exp && test $rr_count -eq $rr_exp; then if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wnone \$file" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wnone $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wnone \$file" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wnone $file" "conflicts.at:2417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wnone $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2417" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2417: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2417" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2417" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2417: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2417" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2417" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2417: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2417" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2417" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wnone \$file" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wnone $file" "conflicts.at:2417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wnone $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2417" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2418: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Werror \$file" at_fn_check_prepare_notrace 'an embedded newline' "conflicts.at:2418" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Werror $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2418" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2418: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror \$file" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror $file" "conflicts.at:2418" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Werror $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2418" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2418: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2418" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2418" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/conflicts.at:2418: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "conflicts.at:2418" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2418" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/conflicts.at:2418: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "conflicts.at:2418" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2418" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/conflicts.at:2418: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror \$file" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror $file" "conflicts.at:2418" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Werror $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/conflicts.at:2418" $at_failed && at_fn_log_failure $at_traceon; } else { issue_note=false if test -z "$sr_exp_i" && test "$sr_count" -ne 0; then echo "warning: $sr_count shift/reduce conflicts" issue_note=true elif test "$sr_exp_i" -ne "$sr_count"; then echo "error: shift/reduce conflicts: $sr_count found, $sr_exp_i expected" if test "$sr_count" -ne 0; then issue_note=true fi fi if test -z "$rr_exp_i" && test "$rr_count" -ne 0; then echo "warning: $rr_count reduce/reduce conflicts" issue_note=true elif test "$rr_exp_i" -ne "$rr_count"; then echo "error: reduce/reduce conflicts: $rr_count found, $rr_exp_i expected" if test "$rr_count" -ne 0; then issue_note=true fi fi if $issue_note; then echo "note: rerun with option '-Wcounterexamples' to generate conflict counterexamples" fi } | sed -e "s/^/$file: /" > experr { set +x printf "%s\n" "$at_srcdir/conflicts.at:2444: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wnone \$file" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wnone $file" "conflicts.at:2444" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wnone $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2444" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/conflicts.at:2445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror \$file" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror $file" "conflicts.at:2445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Werror $file ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/conflicts.at:2445" $at_failed && at_fn_log_failure $at_traceon; } fi done done done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_258 #AT_START_259 at_fn_group_banner 259 'counterexample.at:43' \ "Unifying S/R" " " 11 at_xfail=no ( printf "%s\n" "259. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B C %% s: a x | y c; a: A; c: C; x: B | B C; y: A | A B; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:55" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:55" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:55" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:55" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:55" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:55" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:55" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example: A . B C Shift derivation s \`-> 2: y c \`-> 8: A . B \`-> 4: C Reduce derivation s \`-> 1: a x \`-> 3: A . \`-> 6: B C input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:55" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:55" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:55" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:55" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:55" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:55" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:55: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:55" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example A . B C Shift derivation s -> [ y -> [ A . B ] c -> [ C ] ] Reduce derivation s -> [ a -> [ A . ] x -> [ B C ] ] input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:55" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_259 #AT_START_260 at_fn_group_banner 260 'counterexample.at:83' \ "Deep Unifying S/R" " " 11 at_xfail=no ( printf "%s\n" "260. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B C %% s: ac | a bc; ac: A ac C | b; b: B | B b; a: A | A a; bc: B bc C | B C; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:95" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:95" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:95" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:95" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:95" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:95" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:95" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example: A . B C Shift derivation s \`-> 1: ac \`-> 3: A ac C \`-> 4: b \`-> 5: . B Reduce derivation s \`-> 2: a bc \`-> 7: A . \`-> 10: B C input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example: A A . B B C C Shift derivation s \`-> 1: ac \`-> 3: A ac C \`-> 3: A ac C \`-> 4: b \`-> 6: . b \`-> 5: B B Reduce derivation s \`-> 2: a bc \`-> 8: A a \`-> 9: B bc C \`-> 7: A . \`-> 10: B C input.y:6.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:95" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:95" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:95" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:95" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:95" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:95" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:95: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:95" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example A . B C Shift derivation s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ] Reduce derivation s -> [ a -> [ A . ] bc -> [ B C ] ] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example A A . B B C C Shift derivation s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ] Reduce derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ] input.y:6.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:95" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_260 #AT_START_261 at_fn_group_banner 261 'counterexample.at:144' \ "S/R Conflict with Nullable Symbols" " " 11 at_xfail=no ( printf "%s\n" "261. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B X Y %% s: ax by | A xby; ax: A x; x: %empty | X x; by: B y; y: %empty | Y y; xby: B | X xby Y; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:157" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:157" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:157" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:157" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:157" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:157" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:157" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example: A . B Shift derivation s \`-> 2: A xby \`-> 9: . B Reduce derivation s \`-> 1: ax by \`-> 3: A x \`-> 6: B y \`-> 4: %empty . \`-> 6: %empty input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] First example: A X . B Y \$end Shift derivation \$accept \`-> 0: s \$end \`-> 2: A xby \`-> 10: X xby Y \`-> 9: . B Second example: A X . B y \$end Reduce derivation \$accept \`-> 0: s \$end \`-> 1: ax by \`-> 3: A x \`-> 6: B y \`-> 5: X x \`-> 4: %empty . input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:157" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:157" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:157" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:157" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:157" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:157" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:157: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:157" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example A . B Shift derivation s -> [ A xby -> [ . B ] ] Reduce derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] First example A X . B Y \$end Shift derivation \$accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] \$end ] Second example A X . B y \$end Reduce derivation \$accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] \$end ] input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:157" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_261 #AT_START_262 at_fn_group_banner 262 'counterexample.at:207' \ "Non-unifying Ambiguous S/R" " " 11 at_xfail=no ( printf "%s\n" "262. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B C D E %% g: s | x; s: A x E | A x D E; x: b cd | bc; b: B; cd: C D; bc: B C; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:220" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:220" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:220" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:220" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token C [-Wcounterexamples] First example: B . C \$end Shift derivation \$accept \`-> 0: g \$end \`-> 2: x \`-> 6: bc \`-> 9: B . C Second example: B . C D \$end Reduce derivation \$accept \`-> 0: g \$end \`-> 2: x \`-> 5: b cd \`-> 7: B . \`-> 8: C D input.y:6.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:220" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:220" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:220" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:220" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:220" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:220" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:220: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:220" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token C [-Wcounterexamples] First example B . C \$end Shift derivation \$accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] \$end ] Second example B . C D \$end Reduce derivation \$accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] \$end ] input.y:6.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:220" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_262 #AT_START_263 at_fn_group_banner 263 'counterexample.at:254' \ "Non-unifying Unambiguous S/R" " " 11 at_xfail=no ( printf "%s\n" "263. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B %% s: t | s t; t: x | y; x: A; y: A A B; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:265" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:265" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:265" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:265" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:265" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:265" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:265" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] First example: A . A B \$end Shift derivation \$accept \`-> 0: s \$end \`-> 1: t \`-> 4: y \`-> 6: A . A B Second example: A . A \$end Reduce derivation \$accept \`-> 0: s \$end \`-> 2: s t \`-> 1: t \`-> 3: x \`-> 3: x \`-> 5: A \`-> 5: A . " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:265" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:265" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:265" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:265" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:265" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:265" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:265: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:265" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] First example A . A B \$end Shift derivation \$accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] \$end ] Second example A . A \$end Reduce derivation \$accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] \$end ] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:265" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_263 #AT_START_264 at_fn_group_banner 264 'counterexample.at:298' \ "S/R after first token" " " 11 at_xfail=no ( printf "%s\n" "264. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B X Y %% a: r t | s; r: b; b: B; t: A xx | A x xy; s: b A xx y; x: X; xx: X X; xy: X Y; y: Y; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:314" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:314" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:314" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:314" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:314" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:314" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:314" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] Example: b . A X X Y Shift derivation a \`-> 2: s \`-> 7: b . xx y \`-> 9: A X X \`-> 11: Y Reduce derivation a \`-> 1: r t \`-> 3: b . \`-> 6: A x xy \`-> 8: X \`-> 10: X Y input.y: warning: shift/reduce conflict on token X [-Wcounterexamples] First example: A X . X Shift derivation a \`-> 1: t \`-> 5: A xx \`-> 9: X . X Second example: X . X xy Reduce derivation a \`-> 1: x t \`-> 8: X . \`-> 6: X xy input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] input.y:8.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:314" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:314" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:314" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:314" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:314" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:314" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:314: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:314" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] Example b . A X X Y Shift derivation a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ] Reduce derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ] input.y: warning: shift/reduce conflict on token X [-Wcounterexamples] First example A X . X Shift derivation a -> [ t -> [ A xx -> [ X . X ] ] ] Second example X . X xy Reduce derivation a -> [ x -> [ X . ] t -> [ X xy ] ] input.y:4.4: warning: rule useless in parser due to conflicts [-Wother] input.y:8.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:314" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_264 #AT_START_265 at_fn_group_banner 265 'counterexample.at:363' \ "Unifying R/R counterexample" " " 11 at_xfail=no ( printf "%s\n" "265. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A %% a : A b ; b : A | b; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:372" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:372" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:372" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:372" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on token \$end [-Wcounterexamples] Example: A b . First reduce derivation a \`-> 1: A b . Second reduce derivation a \`-> 1: A b \`-> 3: b . input.y:4.9: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:372" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:372" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:372" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:372" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:372" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:372" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:372: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:372" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on token \$end [-Wcounterexamples] Example A b . First reduce derivation a -> [ A b . ] Second reduce derivation a -> [ A b -> [ b . ] ] input.y:4.9: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:372" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_265 #AT_START_266 at_fn_group_banner 266 'counterexample.at:399' \ "Non-unifying R/R LR(1) conflict" " " 11 at_xfail=no ( printf "%s\n" "266. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A B C D %% s: a A | B a C | b C | B b A; a: D; b: D; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:409" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:409" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:409" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:409" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:409" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:409" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:409" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on tokens A, C [-Wcounterexamples] First example: D . A \$end First reduce derivation \$accept \`-> 0: s \$end \`-> 1: a A \`-> 5: D . Second example: B D . A \$end Second reduce derivation \$accept \`-> 0: s \$end \`-> 4: B b A \`-> 6: D . input.y:5.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:409" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:409" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:409" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:409" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:409" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:409" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:409: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:409" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on tokens A, C [-Wcounterexamples] First example D . A \$end First reduce derivation \$accept -> [ s -> [ a -> [ D . ] A ] \$end ] Second example B D . A \$end Second reduce derivation \$accept -> [ s -> [ B b -> [ D . ] A ] \$end ] input.y:5.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:409" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_266 #AT_START_267 at_fn_group_banner 267 'counterexample.at:441' \ "Non-unifying R/R LR(2) conflict" " " 11 at_xfail=no ( printf "%s\n" "267. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token H J K X %% s: a J; a: H i; i: X | i J K; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:451" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:451" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:451" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:451" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:451" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:451" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:451" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token J [-Wcounterexamples] time limit exceeded: XXX First example: H i . J K \$end Shift derivation \$accept \`-> 0: a \$end \`-> 2: H i \`-> 4: i . J K Second example: H i . J \$end Reduce derivation \$accept \`-> 0: s \$end \`-> 1: a J \`-> 2: H i . input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:451" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:451" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:451" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:451" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:451" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:451" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:451: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:451" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token J [-Wcounterexamples] time limit exceeded: XXX First example H i . J K \$end Shift derivation \$accept -> [ a -> [ H i -> [ i . J K ] ] \$end ] Second example H i . J \$end Reduce derivation \$accept -> [ s -> [ a -> [ H i . ] J ] \$end ] input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:451" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_267 #AT_START_268 at_fn_group_banner 268 'counterexample.at:488' \ "Cex Search Prepend" " " 11 at_xfail=no ( printf "%s\n" "268. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token N A B C D %% s: n | n C; n: N n D | N n C | N a B | N b; a: A; b: A B C | A B D; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:499" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:499" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:499" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:499" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:499" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:499" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:499" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example: N A . B C Shift derivation s \`-> 1: n \`-> 6: N b \`-> 8: A . B C Reduce derivation s \`-> 2: n C \`-> 5: N a B \`-> 7: A . input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example: N N A . B D C Shift derivation s \`-> 1: n \`-> 4: N n C \`-> 6: N b \`-> 9: A . B D Reduce derivation s \`-> 2: n C \`-> 3: N n D \`-> 5: N a B \`-> 7: A . input.y:5.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:499" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:499" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:499" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:499" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:499" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:499" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:499: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:499" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example N A . B C Shift derivation s -> [ n -> [ N b -> [ A . B C ] ] ] Reduce derivation s -> [ n -> [ N a -> [ A . ] B ] C ] input.y: warning: shift/reduce conflict on token B [-Wcounterexamples] Example N N A . B D C Shift derivation s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ] Reduce derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ] input.y:5.4: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:499" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_268 #AT_START_269 at_fn_group_banner 269 'counterexample.at:550' \ "R/R cex with prec" " " 11 at_xfail=no ( printf "%s\n" "269. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %left b %right c %% S: B C | C B; A : B | C | %empty; B : A b A; C : A c A; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:562" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:562" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:562" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:562" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:562" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:562" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:562" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples] Example: B . b c First reduce derivation S \`-> 1: B C \`-> 6: A b A \`-> 7: A c A \`-> 3: B . \`-> 6: %empty \`-> 7: %empty \`-> 7: %empty Second reduce derivation S \`-> 1: B C \`-> 7: A c A \`-> 3: B \`-> 7: %empty \`-> 6: A b A \`-> 5: %empty . \`-> 6: %empty input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples] Example: C . c b First reduce derivation S \`-> 2: C B \`-> 7: A c A \`-> 6: A b A \`-> 4: C . \`-> 7: %empty \`-> 6: %empty \`-> 6: %empty Second reduce derivation S \`-> 2: C B \`-> 6: A b A \`-> 4: C \`-> 6: %empty \`-> 7: A c A \`-> 5: %empty . \`-> 7: %empty " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:562" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:562" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:562" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:562" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:562" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:562" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:562: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:562" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples] Example B . b c First reduce derivation S -> [ B -> [ A -> [ B . ] b A -> [ ] ] C -> [ A -> [ ] c A -> [ ] ] ] Second reduce derivation S -> [ B C -> [ A -> [ B -> [ A -> [ . ] b A -> [ ] ] ] c A -> [ ] ] ] input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples] Example C . c b First reduce derivation S -> [ C -> [ A -> [ C . ] c A -> [ ] ] B -> [ A -> [ ] b A -> [ ] ] ] Second reduce derivation S -> [ C B -> [ A -> [ C -> [ A -> [ . ] c A -> [ ] ] ] b A -> [ ] ] ] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:562" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_269 #AT_START_270 at_fn_group_banner 270 'counterexample.at:610' \ "Null nonterminals" " " 11 at_xfail=no ( printf "%s\n" "270. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A %% a : b d | c d ; b : ; c : ; d : a | c A | d; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:621" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:621" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:621" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:621" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:621" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:621" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:621" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] First example: . c A A \$end First reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 3: %empty . \`-> 6: c A A Second example: . c A A \$end Second reduce derivation \$accept \`-> 0: a \$end \`-> 2: c d \`-> 4: %empty . \`-> 6: c A A input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] time limit exceeded: XXX First example: b . c A A \$end First reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 5: a \`-> 1: b d \`-> 3: %empty . \`-> 6: c A A Second example: b . A \$end Second reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 6: c A \`-> 4: %empty . input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] time limit exceeded: XXX First example: c . c A A \$end First reduce derivation \$accept \`-> 0: a \$end \`-> 2: c d \`-> 5: a \`-> 1: b d \`-> 3: %empty . \`-> 6: c A A Second example: c . A \$end Second reduce derivation \$accept \`-> 0: a \$end \`-> 2: c d \`-> 6: c A \`-> 4: %empty . input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] time limit exceeded: XXX First example: b c . A Shift derivation a \`-> 1: b d \`-> 6: c . A Second example: b c . c A A \$end Reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 5: a \`-> 2: c d \`-> 5: a \`-> 1: b d \`-> 3: %empty . \`-> 6: c A A input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] First example: b c . c A A \$end First reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 5: a \`-> 2: c d \`-> 5: a \`-> 1: b d \`-> 3: %empty . \`-> 6: c A A Second example: b c . A \$end Second reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 5: a \`-> 2: c d \`-> 6: c A \`-> 4: %empty . input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] First example: b c . A Shift derivation a \`-> 1: b d \`-> 6: c . A Second example: b c . A \$end Reduce derivation \$accept \`-> 0: a \$end \`-> 1: b d \`-> 5: a \`-> 2: c d \`-> 6: c A \`-> 4: %empty . input.y: warning: reduce/reduce conflict on token \$end [-Wcounterexamples] Example: b d . First reduce derivation a \`-> 1: b d . Second reduce derivation a \`-> 1: b d \`-> 7: d . input.y: warning: reduce/reduce conflict on token \$end [-Wcounterexamples] Example: c d . First reduce derivation a \`-> 2: c d . Second reduce derivation a \`-> 2: c d \`-> 7: d . input.y:5.4: warning: rule useless in parser due to conflicts [-Wother] input.y:6.15: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:621" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:621" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:621" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:621" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:621" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:621" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:621: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:621" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr] input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] First example . c A A \$end First reduce derivation \$accept -> [ a -> [ b -> [ . ] d -> [ c A A ] ] \$end ] Second example . c A A \$end Second reduce derivation \$accept -> [ a -> [ c -> [ . ] d -> [ c A A ] ] \$end ] input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] time limit exceeded: XXX First example b . c A A \$end First reduce derivation \$accept -> [ a -> [ b d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] \$end ] Second example b . A \$end Second reduce derivation \$accept -> [ a -> [ b d -> [ c -> [ . ] A ] ] \$end ] input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] time limit exceeded: XXX First example c . c A A \$end First reduce derivation \$accept -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] \$end ] Second example c . A \$end Second reduce derivation \$accept -> [ a -> [ c d -> [ c -> [ . ] A ] ] \$end ] input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] time limit exceeded: XXX First example b c . A Shift derivation a -> [ b d -> [ c . A ] ] Second example b c . c A A \$end Reduce derivation \$accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] \$end ] input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples] First example b c . c A A \$end First reduce derivation \$accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] \$end ] Second example b c . A \$end Second reduce derivation \$accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] \$end ] input.y: warning: shift/reduce conflict on token A [-Wcounterexamples] First example b c . A Shift derivation a -> [ b d -> [ c . A ] ] Second example b c . A \$end Reduce derivation \$accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] \$end ] input.y: warning: reduce/reduce conflict on token \$end [-Wcounterexamples] Example b d . First reduce derivation a -> [ b d . ] Second reduce derivation a -> [ b d -> [ d . ] ] input.y: warning: reduce/reduce conflict on token \$end [-Wcounterexamples] Example c d . First reduce derivation a -> [ c d . ] Second reduce derivation a -> [ c d -> [ d . ] ] input.y:5.4: warning: rule useless in parser due to conflicts [-Wother] input.y:6.15: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:621" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_270 #AT_START_271 at_fn_group_banner 271 'counterexample.at:797' \ "Non-unifying Prefix Share" " " 11 at_xfail=no ( printf "%s\n" "271. $at_setup_line: testing $at_desc ..." $at_traceon # Tests for a counterexample which should start its derivation # at a shared symbol rather than the start symbol. cat >input.y <<'_ATEOF' %token H J %% s: a | a J; a: H i J J i: %empty | i J; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:810" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:810" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:810" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:810" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:810" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:810" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:810" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token J [-Wcounterexamples] Example: H i J . J J Shift derivation s \`-> 2: a J \`-> 3: H i J . J Reduce derivation s \`-> 1: a \`-> 3: H i J J \`-> 5: i J . input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:810" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:810" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:810" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:810" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:810" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:810" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:810: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:810" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token J [-Wcounterexamples] Example H i J . J J Shift derivation s -> [ a -> [ H i J . J ] J ] Reduce derivation s -> [ a -> [ H i -> [ i J . ] J J ] ] input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:810" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_271 #AT_START_272 at_fn_group_banner 272 'counterexample.at:842' \ "Deep Null Unifying" " " 11 at_xfail=no ( printf "%s\n" "272. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A D %% s: A a d | A a a d; a: b; b: c c: %empty d: D; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:854" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:854" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:854" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:854" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:854" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:854" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:854" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token D [-Wcounterexamples] Example: A a . D Shift derivation s \`-> 1: A a d \`-> 6: . D Reduce derivation s \`-> 2: A a a d \`-> 3: b \`-> 6: D \`-> 4: c \`-> 5: %empty . " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:854" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:854" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:854" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:854" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:854" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:854" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:854: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:854" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token D [-Wcounterexamples] Example A a . D Shift derivation s -> [ A a d -> [ . D ] ] Reduce derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:854" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_272 #AT_START_273 at_fn_group_banner 273 'counterexample.at:884' \ "Deep Null Non-unifying" " " 11 at_xfail=no ( printf "%s\n" "273. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token A D E %% s: A a d | A a a d E; a: b; b: c c: %empty d: D; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:896" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:896" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:896" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:896" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:896" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:896" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Avoid trailing white spaces. { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *\$//;' stderr" at_fn_check_prepare_dynamic "sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr" "counterexample.at:896" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g;s/ *$//;' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token D [-Wcounterexamples] First example: A a . D \$end Shift derivation \$accept \`-> 0: s \$end \`-> 1: A a d \`-> 6: . D Second example: A a . D E \$end Reduce derivation \$accept \`-> 0: s \$end \`-> 2: A a a d E \`-> 3: b \`-> 6: D \`-> 4: c \`-> 5: %empty . " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wcounterexamples input.y" at_fn_check_prepare_notrace 'an embedded newline' "counterexample.at:896" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" at_fn_check_prepare_dynamic "YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y" "counterexample.at:896" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:896" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "counterexample.at:896" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: \$XSLTPROC \\ \`YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "counterexample.at:896" ( $at_check_trace; $XSLTPROC \ `YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y" at_fn_check_prepare_trace "counterexample.at:896" ( $at_check_trace; YYFLAT=1; export YYFLAT;COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wcounterexamples input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/counterexample.at:896: sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr" at_fn_check_prepare_trace "counterexample.at:896" ( $at_check_trace; sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] input.y: warning: shift/reduce conflict on token D [-Wcounterexamples] First example A a . D \$end Shift derivation \$accept -> [ s -> [ A a d -> [ . D ] ] \$end ] Second example A a . D E \$end Reduce derivation \$accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] \$end ] " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/counterexample.at:896" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_273 #AT_START_274 at_fn_group_banner 274 'synclines.at:194' \ "Prologue syncline" " " 12 at_xfail=no ( printf "%s\n" "274. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %{ #error "2" %} %code { void yyerror (const char *msg); int yylex (void); } %% exp: '0'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:194: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:194" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:194: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:194" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:194: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:194" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:194: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:194" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:194: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:194" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:194: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:194" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:194: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:194" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:194: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:194" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:194: cat stdout" at_fn_check_prepare_trace "synclines.at:194" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:2: #error \"2\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:194" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_274 #AT_START_275 at_fn_group_banner 275 'synclines.at:214' \ "%union syncline" " " 12 at_xfail=no ( printf "%s\n" "275. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %union { #error "2" char dummy; } %code { void yyerror (const char *msg); int yylex (void); } %% exp: '0'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:214: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:214" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:214: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:214" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:214: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:214" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:214: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:214" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:214: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:214" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:214: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:214" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:214: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:214" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:214: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:214" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:214: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:214" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:214: cat stdout" at_fn_check_prepare_trace "synclines.at:214" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:2: #error \"2\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:214" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_275 #AT_START_276 at_fn_group_banner 276 'synclines.at:237' \ "%union name syncline" " " 12 at_xfail=no ( printf "%s\n" "276. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %union break { char dummy; } %code { void yyerror (const char *msg); int yylex (void); %} %% exp: '0'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:253" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:253" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:253: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:253" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:253" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:253: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:253" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:253" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:253: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:253" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:253" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:253: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:253" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:253" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:254: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:254" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:254" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:254: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:254" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:254" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:254: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:254" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:254" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:254: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:254" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:254" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:254: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:254" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:254" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:255: grep '^input.y:1' stdout" at_fn_check_prepare_trace "synclines.at:255" ( $at_check_trace; grep '^input.y:1' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:255" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_276 #AT_START_277 at_fn_group_banner 277 'synclines.at:264' \ "Postprologue syncline" " " 12 at_xfail=no ( printf "%s\n" "277. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code { void yyerror (const char *msg); int yylex (void); } %{ /* Preprologue. */ %} %union { int ival; } %{ #error "13" %} %% exp: '0'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:264: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:264" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:264: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:264" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:264: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:264" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:264: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:264" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:264: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:264" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:264: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:264" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:264: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:264" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:264: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:264" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:264: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:264" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:264: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:264" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:264: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:264" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:264: cat stdout" at_fn_check_prepare_trace "synclines.at:264" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:13: #error \"13\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:264" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_277 #AT_START_278 at_fn_group_banner 278 'synclines.at:291' \ "Action syncline" " " 12 at_xfail=no ( printf "%s\n" "278. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code { void yyerror (const char *msg); int yylex (void); } %% exp: { #error "8" }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:291: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:291" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:291: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:291" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:291: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:291" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:291: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:291" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:291: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:291" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:291: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:291" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:291: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:291" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:291: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:291" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:291: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:291" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:291: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:291" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:291: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:291" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:291: cat stdout" at_fn_check_prepare_trace "synclines.at:291" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:8: #error \"8\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:291" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_278 #AT_START_279 at_fn_group_banner 279 'synclines.at:310' \ "Epilogue syncline" " " 12 at_xfail=no ( printf "%s\n" "279. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code { void yyerror (const char *msg); int yylex (void); } %% exp: '0'; %% #error "8" _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:310: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:310" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:310: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:310" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:310: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:310" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:310: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:310" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:310: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:310" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:310: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:310" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:310: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:310" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:310: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:310" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:310: cat stdout" at_fn_check_prepare_trace "synclines.at:310" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:8: #error \"8\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:310" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_279 #AT_START_280 at_fn_group_banner 280 'synclines.at:327' \ "%code top syncline" " " 12 at_xfail=no ( printf "%s\n" "280. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { #error "2" } %code { void yyerror (const char *msg); int yylex (void); } %% exp: '0'; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:327: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:327" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:327: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:327" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:327: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:327" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:327: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:327" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:327: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:327" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:327: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:327" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:327: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:327" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:327: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:327" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:327: cat stdout" at_fn_check_prepare_trace "synclines.at:327" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:2: #error \"2\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:327" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_280 #AT_START_281 at_fn_group_banner 281 'synclines.at:346' \ "%destructor syncline" " " 12 at_xfail=no ( printf "%s\n" "281. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %destructor { #error "2" } %{ void yyerror (const char *msg); int yylex (void); %} %union { int ival; } %type exp %% exp: '0' { $$ = 0; }; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:346: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:346" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:346: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:346" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:346: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:346" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:346: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:346" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:346: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:346" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:346: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:346" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:346: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:346" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:346: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:346" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:346: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:346" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:346: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:346" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:346: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:346" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:346: cat stdout" at_fn_check_prepare_trace "synclines.at:346" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:2: #error \"2\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:346" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_281 #AT_START_282 at_fn_group_banner 282 'synclines.at:370' \ "%printer syncline" " " 12 at_xfail=no ( printf "%s\n" "282. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %printer { #error "2" } %debug %code { void yyerror (const char *msg); int yylex (void); } %union { int ival; } %type exp %% exp: '0' { $$ = 0; }; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:370: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:370" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:370: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:370" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:370: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:370" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } # Check if we can trust location translation. cat >syncline.c <<'_ATEOF' void foo (void); void foo (void) { #error "4" } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:370: \$CC \$CFLAGS \$CPPFLAGS -c syncline.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c syncline.c" "synclines.at:370" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c syncline.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:370: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:370" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:370: test \"\`cat stdout\`\" = 'syncline.c:4: #error \"4\"' || exit 77" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:370" ( $at_check_trace; test "`cat stdout`" = 'syncline.c:4: #error "4"' || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } # Then work for real. { set +x printf "%s\n" "$at_srcdir/synclines.at:370: \$CC \$CFLAGS \$CPPFLAGS -c input.c" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c input.c" "synclines.at:370" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:370: \"\$PERL\" -p -0777 - stderr <<\\EOF || exit 77 # Remove left-hand margin. s/^[\\d ]{6}\\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\\[\\d+\\] .*\\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\\+\\+'.*\\n//gm; # Function context. s/^[^:]*: In function '[^']+':\\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\\n *\\^~*\\n//gm; # Number of errors. s/^1 error generated\\.\\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., \"1540-0218 (S)\"). s/^\"(.*?)\", line ([\\w.]*): \\d+-\\d+ \\(.\\) /\$1:\$2: /gm; # Remove column. s/^([^:]+:\\d+)[.:][^:]+:(.+)\$/\$1:\$2/gm; # Map all combinations of \"error: \" and \"#error: \" to \"#error \". s/^([^:]+:\\d+):( |#error|error|:)+/\$1: #error /gm; EOF " at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:370" ( $at_check_trace; "$PERL" -p -0777 - stderr <<\EOF || exit 77 # Remove left-hand margin. s/^[\d ]{6}\| //gm; # 1. Remove useless lines. # distcc clutter. s/^distcc\[\d+\] .*\n//gm; # c vs. c++. s/^clang: warning: treating 'c' input as 'c\+\+'.*\n//gm; # Function context. s/^[^:]*: In function '[^']+':\n//gm; # Caret error (with possible '~' to underline). s/^ *#error.*\n *\^~*\n//gm; # Number of errors. s/^1 error generated\.\n//gm; # 2. Normalize the lines we kept. # xlc messages. Remove also error identifier (e.g., "1540-0218 (S)"). s/^"(.*?)", line ([\w.]*): \d+-\d+ \(.\) /$1:$2: /gm; # Remove column. s/^([^:]+:\d+)[.:][^:]+:(.+)$/$1:$2/gm; # Map all combinations of "error: " and "#error: " to "#error ". s/^([^:]+:\d+):( |#error|error|:)+/$1: #error /gm; EOF ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:370: cat stdout" at_fn_check_prepare_trace "synclines.at:370" ( $at_check_trace; cat stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "input.y:2: #error \"2\" " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:370" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_282 #AT_START_283 at_fn_group_banner 283 'synclines.at:440' \ "syncline escapes: yacc.c" " " 12 at_xfail=no ( printf "%s\n" "283. $at_setup_line: testing $at_desc ..." $at_traceon # ICC is unable to handle these file names: it fails to pass them # properly to the linker, and is unable to save a file named this way. # Don't try with such compilers. cat >\"\\\"\".c <<'_ATEOF' int main (void) { return 0; } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CC \$CFLAGS \$CPPFLAGS \\\"\\\\\\\"\\\".c -o \\\"\\\\\\\"\\\" || exit 77" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS \\\"\\\\\\\"\\\".c -o \\\"\\\\\\\"\\\" || exit 77" "synclines.at:440" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS \"\\\"\".c -o \"\\\"\" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cat >\"\\\"\".y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "yacc.c" %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %destructor {} <> %printer {} <> %% exp: '0' %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Maybe we tried to create a file name that the file system does not # support. printf "%s\n" "synclines.at:440" >"$at_check_line_file" (test ! -f \"\\\"\".y) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o \"\\\"\".c \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\"\".c \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\"\".c \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "synclines.at:440" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".c $LIBS" "synclines.at:440" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_283 #AT_START_284 at_fn_group_banner 284 'synclines.at:440' \ "syncline escapes: glr.c" " " 12 at_xfail=no ( printf "%s\n" "284. $at_setup_line: testing $at_desc ..." $at_traceon # ICC is unable to handle these file names: it fails to pass them # properly to the linker, and is unable to save a file named this way. # Don't try with such compilers. cat >\"\\\"\".c <<'_ATEOF' int main (void) { return 0; } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CC \$CFLAGS \$CPPFLAGS \\\"\\\\\\\"\\\".c -o \\\"\\\\\\\"\\\" || exit 77" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS \\\"\\\\\\\"\\\".c -o \\\"\\\\\\\"\\\" || exit 77" "synclines.at:440" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS \"\\\"\".c -o \"\\\"\" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cat >\"\\\"\".y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.c" %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %destructor {} <> %printer {} <> %% exp: '0' %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Maybe we tried to create a file name that the file system does not # support. printf "%s\n" "synclines.at:440" >"$at_check_line_file" (test ! -f \"\\\"\".y) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o \"\\\"\".c \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\"\".c \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \\\"\\\\\\\"\\\".c \\\"\\\\\\\"\\\".y" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\"\".c \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "synclines.at:440" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".c $LIBS" "synclines.at:440" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_284 #AT_START_285 at_fn_group_banner 285 'synclines.at:440' \ "syncline escapes: lalr1.cc" " " 12 at_xfail=no ( printf "%s\n" "285. $at_setup_line: testing $at_desc ..." $at_traceon # ICC is unable to handle these file names: it fails to pass them # properly to the linker, and is unable to save a file named this way. # Don't try with such compilers. cat >\"\\\"\".cc <<'_ATEOF' int main (void) { return 0; } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CXX \$CXXFLAGS \$CPPFLAGS \\\"\\\\\\\"\\\".cc -o \\\"\\\\\\\"\\\" || exit 77" at_fn_check_prepare_dynamic "$CXX $CXXFLAGS $CPPFLAGS \\\"\\\\\\\"\\\".cc -o \\\"\\\\\\\"\\\" || exit 77" "synclines.at:440" ( $at_check_trace; $CXX $CXXFLAGS $CPPFLAGS \"\\\"\".cc -o \"\\\"\" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cat >\"\\\"\".y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { static int yylex (yy::parser::value_type *lvalp); } %destructor {} <> %printer {} <> %% exp: '0' %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF # Maybe we tried to create a file name that the file system does not # support. printf "%s\n" "synclines.at:440" >"$at_check_line_file" (test ! -f \"\\\"\".y) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "synclines.at:440" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".cc $LIBS" "synclines.at:440" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_285 #AT_START_286 at_fn_group_banner 286 'synclines.at:440' \ "syncline escapes: glr.cc" " " 12 at_xfail=no ( printf "%s\n" "286. $at_setup_line: testing $at_desc ..." $at_traceon # ICC is unable to handle these file names: it fails to pass them # properly to the linker, and is unable to save a file named this way. # Don't try with such compilers. cat >\"\\\"\".cc <<'_ATEOF' int main (void) { return 0; } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CXX \$CXXFLAGS \$CPPFLAGS \\\"\\\\\\\"\\\".cc -o \\\"\\\\\\\"\\\" || exit 77" at_fn_check_prepare_dynamic "$CXX $CXXFLAGS $CPPFLAGS \\\"\\\\\\\"\\\".cc -o \\\"\\\\\\\"\\\" || exit 77" "synclines.at:440" ( $at_check_trace; $CXX $CXXFLAGS $CPPFLAGS \"\\\"\".cc -o \"\\\"\" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cat >\"\\\"\".y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %code { static int yylex (yy::parser::value_type *lvalp); } %destructor {} <> %printer {} <> %% exp: '0' %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF # Maybe we tried to create a file name that the file system does not # support. printf "%s\n" "synclines.at:440" >"$at_check_line_file" (test ! -f \"\\\"\".y) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "synclines.at:440" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".cc $LIBS" "synclines.at:440" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_286 #AT_START_287 at_fn_group_banner 287 'synclines.at:440' \ "syncline escapes: glr2.cc" " " 12 at_xfail=no ( printf "%s\n" "287. $at_setup_line: testing $at_desc ..." $at_traceon # ICC is unable to handle these file names: it fails to pass them # properly to the linker, and is unable to save a file named this way. # Don't try with such compilers. cat >\"\\\"\".cc <<'_ATEOF' int main (void) { return 0; } _ATEOF { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CXX \$CXXFLAGS \$CPPFLAGS \\\"\\\\\\\"\\\".cc -o \\\"\\\\\\\"\\\" || exit 77" at_fn_check_prepare_dynamic "$CXX $CXXFLAGS $CPPFLAGS \\\"\\\\\\\"\\\".cc -o \\\"\\\\\\\"\\\" || exit 77" "synclines.at:440" ( $at_check_trace; $CXX $CXXFLAGS $CPPFLAGS \"\\\"\".cc -o \"\\\"\" || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cat >\"\\\"\".y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr2.cc" %code { static int yylex (yy::parser::value_type *lvalp); } %destructor {} <> %printer {} <> %% exp: '0' %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF # Maybe we tried to create a file name that the file system does not # support. printf "%s\n" "synclines.at:440" >"$at_check_line_file" (test ! -f \"\\\"\".y) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:440: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \\\"\\\\\\\"\\\".cc \\\"\\\\\\\"\\\".y" at_fn_check_prepare_trace "synclines.at:440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o \"\\\"\".cc \"\\\"\".y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "synclines.at:440" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" printf "%s\n" "synclines.at:440" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/synclines.at:440" { set +x printf "%s\n" "$at_srcdir/synclines.at:440: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o \\\"\\\\\\\"\\\" \\\"\\\\\\\"\\\".cc $LIBS" "synclines.at:440" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o \"\\\"\" \"\\\"\".cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:440" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_287 #AT_START_288 at_fn_group_banner 288 'synclines.at:497' \ "%no-lines: yacc.c" " " 12 at_xfail=no ( printf "%s\n" "288. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "yacc.c" %header %{ void yyerror (const char *msg); int yylex (void); %} %union { int ival; } %% exp: '0' _ATEOF # Generate without.* without the #line. Don't use -o without.c which # would change the content (e.g., CPP guard depend on the output file # name). if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-lines -o input.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-lines -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.c -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.c -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.c without.c" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.c without.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.h without.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.h without.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # There is no #line at all. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep '#line' *.c *.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep '#line' *.c *.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Generate with.* without the #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.c with.c" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.c with.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.h with.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.h with.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # The implementation file with --no-line is exactly the # original one with #lines removed. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.c >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.c >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.c" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Likewise for the header. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.h >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.h >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_288 #AT_START_289 at_fn_group_banner 289 'synclines.at:497' \ "%no-lines: glr.c" " " 12 at_xfail=no ( printf "%s\n" "289. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.c" %header %{ void yyerror (const char *msg); int yylex (void); %} %union { int ival; } %% exp: '0' _ATEOF # Generate without.* without the #line. Don't use -o without.c which # would change the content (e.g., CPP guard depend on the output file # name). if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-lines -o input.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-lines -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.c -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.c -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.c without.c" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.c without.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.h without.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.h without.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # There is no #line at all. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep '#line' *.c *.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep '#line' *.c *.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Generate with.* without the #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.c with.c" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.c with.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.h with.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.h with.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # The implementation file with --no-line is exactly the # original one with #lines removed. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.c >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.c >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.c" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Likewise for the header. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.h >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.h >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.h" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_289 #AT_START_290 at_fn_group_banner 290 'synclines.at:497' \ "%no-lines: lalr1.cc" " " 12 at_xfail=no ( printf "%s\n" "290. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %header %{ int yylex (yy::parser::value_type *lvalp); %} %union { int ival; } %% exp: '0' _ATEOF # Generate without.* without the #line. Don't use -o without.c which # would change the content (e.g., CPP guard depend on the output file # name). if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-lines -o input.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.cc -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.cc without.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.cc without.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.hh without.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.hh without.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # There is no #line at all. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep '#line' *.cc *.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep '#line' *.cc *.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Generate with.* without the #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.cc with.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.cc with.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.hh with.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.hh with.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # The implementation file with --no-line is exactly the # original one with #lines removed. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.cc >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.cc >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Likewise for the header. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.hh >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.hh >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_290 #AT_START_291 at_fn_group_banner 291 'synclines.at:497' \ "%no-lines: glr.cc" " " 12 at_xfail=no ( printf "%s\n" "291. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %header %{ int yylex (yy::parser::value_type *lvalp); %} %union { int ival; } %% exp: '0' _ATEOF # Generate without.* without the #line. Don't use -o without.c which # would change the content (e.g., CPP guard depend on the output file # name). if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-lines -o input.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.cc -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.cc without.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.cc without.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.hh without.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.hh without.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # There is no #line at all. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep '#line' *.cc *.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep '#line' *.cc *.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Generate with.* without the #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.cc with.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.cc with.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.hh with.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.hh with.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # The implementation file with --no-line is exactly the # original one with #lines removed. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.cc >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.cc >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Likewise for the header. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.hh >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.hh >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_291 #AT_START_292 at_fn_group_banner 292 'synclines.at:497' \ "%no-lines: glr2.cc" " " 12 at_xfail=no ( printf "%s\n" "292. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr2.cc" %header %{ int yylex (yy::parser::value_type *lvalp); %} %union { int ival; } %% exp: '0' _ATEOF # Generate without.* without the #line. Don't use -o without.c which # would change the content (e.g., CPP guard depend on the output file # name). if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-lines -o input.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.cc -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-lines -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.cc without.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.cc without.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.hh without.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.hh without.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # There is no #line at all. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep '#line' *.cc *.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep '#line' *.cc *.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Generate with.* without the #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc -d input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y" "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:497: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:497" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:497: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -d input.y" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc -d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.cc with.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.cc with.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: mv input.hh with.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; mv input.hh with.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # The implementation file with --no-line is exactly the # original one with #lines removed. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.cc >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.cc >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.cc" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Likewise for the header. { set +x printf "%s\n" "$at_srcdir/synclines.at:497: grep -v '#line' with.hh >expout" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; grep -v '#line' with.hh >expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:497: cat without.hh" at_fn_check_prepare_trace "synclines.at:497" ( $at_check_trace; cat without.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:497" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_292 #AT_START_293 at_fn_group_banner 293 'synclines.at:507' \ "Output columns" " " 12 at_xfail=no ( printf "%s\n" "293. $at_setup_line: testing $at_desc ..." $at_traceon # This test is fragile: its point is to check the compiler's error # message, but it seems too hard to do portability (even between # version of GCC). So instead, let's just check the generated code # itself. cat >input.y <<'_ATEOF' %{ void yyerror (const char *msg); int yylex (void); %} %define api.value.type union %type '0' exp %destructor { /* --BEGIN */ destructor /* --END */ } <*> %printer { /* --BEGIN */ printer /* --END */ } <*> %left '+' %% exp: exp '+' exp { /* --BEGIN */ $$ = $1 + $3; @$ = @1 + @3; /* --END */ } | '0' _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/synclines.at:540: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:540" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:540" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:540: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "synclines.at:540" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:540" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/synclines.at:540: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:540" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:540" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/synclines.at:540: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "synclines.at:540" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:540" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/synclines.at:540: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "synclines.at:540" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:540" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/synclines.at:540: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "synclines.at:540" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:540" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/synclines.at:541: sed -ne '/--BEGIN/,/--END/{' \\ -e '/input.c/s/ [0-9]* / LINE /;' \\ -e 'p;}' \\ input.c" at_fn_check_prepare_notrace 'an embedded newline' "synclines.at:541" ( $at_check_trace; sed -ne '/--BEGIN/,/--END/{' \ -e '/input.c/s/ [0-9]* / LINE /;' \ -e 'p;}' \ input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " { /* --BEGIN */ printer /* --END */ } { /* --BEGIN */ printer /* --END */ } { /* --BEGIN */ destructor /* --END */ } { /* --BEGIN */ destructor /* --END */ } { /* --BEGIN */ (yyval.exp) = (yyvsp[-2].exp) + (yyvsp[0].exp); (yyloc) = (yylsp[-2]) + (yylsp[0]); /* --END */ } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/synclines.at:541" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_293 #AT_START_294 at_fn_group_banner 294 'headers.at:56' \ "Invalid CPP guards: --defines=input/input.h" " " 13 at_xfail=no ( printf "%s\n" "294. $at_setup_line: testing $at_desc ..." $at_traceon # Possibly create inner directories. dirname=`$as_dirname -- input/input || $as_expr Xinput/input : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ Xinput/input : 'X\(//\)[^/]' \| \ Xinput/input : 'X\(//\)$' \| \ Xinput/input : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" Xinput/input | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirname; as_fn_mkdir_p cat >input/input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include void yyerror (const char *msg); int yylex (void); %} %% dummy: %empty; %% #include _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:56: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --defines=input/input.h --output=input/input.c input/input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:56" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --defines=input/input.h --output=input/input.c input/input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:56: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=input/input.h --output=input/input.c input/input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=input/input.h --output=input/input.c input/input.y" "headers.at:56" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=input/input.h --output=input/input.c input/input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:56: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:56" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:56: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:56" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:56: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:56" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:56: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=input/input.h --output=input/input.c input/input.y" at_fn_check_prepare_trace "headers.at:56" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=input/input.h --output=input/input.c input/input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:56" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:56" { set +x printf "%s\n" "$at_srcdir/headers.at:56: \$CC \$CFLAGS \$CPPFLAGS -c -o input/input.o -I. -c input/input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input/input.o -I. -c input/input.c " "headers.at:56" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input/input.o -I. -c input/input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:56" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_294 #AT_START_295 at_fn_group_banner 295 'headers.at:57' \ "Invalid CPP guards: --defines=9foo.h" " " 13 at_xfail=no ( printf "%s\n" "295. $at_setup_line: testing $at_desc ..." $at_traceon # Possibly create inner directories. dirname=`$as_dirname -- 9foo || $as_expr X9foo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X9foo : 'X\(//\)[^/]' \| \ X9foo : 'X\(//\)$' \| \ X9foo : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X9foo | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirname; as_fn_mkdir_p cat >9foo.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include <9foo.h> void yyerror (const char *msg); int yylex (void); %} %% dummy: %empty; %% #include <9foo.h> _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:57: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --defines=9foo.h --output=9foo.c 9foo.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:57" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --defines=9foo.h --output=9foo.c 9foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:57: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=9foo.h --output=9foo.c 9foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=9foo.h --output=9foo.c 9foo.y" "headers.at:57" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=9foo.h --output=9foo.c 9foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:57: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:57" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:57: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:57" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:57: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:57" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:57: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=9foo.h --output=9foo.c 9foo.y" at_fn_check_prepare_trace "headers.at:57" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=9foo.h --output=9foo.c 9foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:57" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:57" { set +x printf "%s\n" "$at_srcdir/headers.at:57: \$CC \$CFLAGS \$CPPFLAGS -c -o 9foo.o -I. -c 9foo.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o 9foo.o -I. -c 9foo.c " "headers.at:57" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o 9foo.o -I. -c 9foo.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:57" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_295 #AT_START_296 at_fn_group_banner 296 'headers.at:58' \ "Invalid CPP guards: %glr-parser --defines=input/input.h" "" 13 at_xfail=no ( printf "%s\n" "296. $at_setup_line: testing $at_desc ..." $at_traceon # Possibly create inner directories. dirname=`$as_dirname -- input/input || $as_expr Xinput/input : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ Xinput/input : 'X\(//\)[^/]' \| \ Xinput/input : 'X\(//\)$' \| \ Xinput/input : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" Xinput/input | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirname; as_fn_mkdir_p cat >input/input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %{ #include void yyerror (const char *msg); int yylex (void); %} %% dummy: %empty; %% #include _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:58: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --defines=input/input.h --output=input/input.c input/input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:58" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --defines=input/input.h --output=input/input.c input/input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:58: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=input/input.h --output=input/input.c input/input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=input/input.h --output=input/input.c input/input.y" "headers.at:58" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=input/input.h --output=input/input.c input/input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:58: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:58" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:58: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:58" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:58: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:58" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:58: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=input/input.h --output=input/input.c input/input.y" at_fn_check_prepare_trace "headers.at:58" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=input/input.h --output=input/input.c input/input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:58" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:58" { set +x printf "%s\n" "$at_srcdir/headers.at:58: \$CC \$CFLAGS \$CPPFLAGS -c -o input/input.o -I. -c input/input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input/input.o -I. -c input/input.c " "headers.at:58" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input/input.o -I. -c input/input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:58" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_296 #AT_START_297 at_fn_group_banner 297 'headers.at:59' \ "Invalid CPP guards: %glr-parser --defines=9foo.h" "" 13 at_xfail=no ( printf "%s\n" "297. $at_setup_line: testing $at_desc ..." $at_traceon # Possibly create inner directories. dirname=`$as_dirname -- 9foo || $as_expr X9foo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X9foo : 'X\(//\)[^/]' \| \ X9foo : 'X\(//\)$' \| \ X9foo : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X9foo | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirname; as_fn_mkdir_p cat >9foo.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %{ #include <9foo.h> void yyerror (const char *msg); int yylex (void); %} %% dummy: %empty; %% #include <9foo.h> _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:59: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --defines=9foo.h --output=9foo.c 9foo.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:59" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --defines=9foo.h --output=9foo.c 9foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:59: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=9foo.h --output=9foo.c 9foo.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=9foo.h --output=9foo.c 9foo.y" "headers.at:59" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --defines=9foo.h --output=9foo.c 9foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:59: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:59" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:59: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:59" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:59: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:59" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:59: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=9foo.h --output=9foo.c 9foo.y" at_fn_check_prepare_trace "headers.at:59" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --defines=9foo.h --output=9foo.c 9foo.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:59" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:59" { set +x printf "%s\n" "$at_srcdir/headers.at:59: \$CC \$CFLAGS \$CPPFLAGS -c -o 9foo.o -I. -c 9foo.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o 9foo.o -I. -c 9foo.c " "headers.at:59" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o 9foo.o -I. -c 9foo.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:59" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_297 #AT_START_298 at_fn_group_banner 298 'headers.at:67' \ "export YYLTYPE" " " 13 at_xfail=no ( printf "%s\n" "298. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %name-prefix "my_" %{ #include #include /* A C error reporting function. */ /* !POSIX */ static void my_error (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int my_lex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } %} %% exp: %empty; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header -o input.c input.y" "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:85: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:85" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:85: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:85" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:85: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:85" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --header -o input.c input.y" at_fn_check_prepare_trace "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:11.1-18: warning: deprecated directive: '%name-prefix \"my_\"', use '%define api.prefix {my_}' [-Wdeprecated] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y -Werror" "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:11.1-18: warning: deprecated directive: '%name-prefix "my_"', use '%define api.prefix {my_}' [-Wdeprecated] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/headers.at:85: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "headers.at:85" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y --warnings=error" "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y -Wnone,none -Werror --trace=none" "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:85: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y --warnings=none -Werror --trace=none" "headers.at:85" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:85" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi # YYLTYPE should be defined, and MY_LLOC declared. cat >caller.c <<'_ATEOF' #include "input.h" YYLTYPE *my_llocp = &my_lloc; int my_parse (void); #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return my_parse (); } _ATEOF # Link and execute, just to make sure everything is fine (and in # particular, that MY_LLOC is indeed defined somewhere). printf "%s\n" "headers.at:102" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:102" { set +x printf "%s\n" "$at_srcdir/headers.at:102: \$CC \$CFLAGS \$CPPFLAGS -c -o caller.o caller.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o caller.o caller.c " "headers.at:102" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o caller.o caller.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:102" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:103" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:103" { set +x printf "%s\n" "$at_srcdir/headers.at:103: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:103" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:103" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:104" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:104" { set +x printf "%s\n" "$at_srcdir/headers.at:104: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o caller caller.o input.o \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o caller caller.o input.o $LIBS" "headers.at:104" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o caller caller.o input.o $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:104" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:105: \$PREPARSER ./caller" at_fn_check_prepare_dynamic " $PREPARSER ./caller" "headers.at:105" ( $at_check_trace; $PREPARSER ./caller ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:105" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:105: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "headers.at:105" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:105" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_298 #AT_START_299 at_fn_group_banner 299 'headers.at:177' \ "Sane headers: " " " 13 at_xfail=no ( printf "%s\n" "299. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: X { printf ("x\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {X, 0}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:177: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:177" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:177: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:177" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:177: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:177" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:177: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:177" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:177: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:177" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:177: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:177" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:177" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:177" { set +x printf "%s\n" "$at_srcdir/headers.at:177: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:177" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:177" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:177" { set +x printf "%s\n" "$at_srcdir/headers.at:177: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:177" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:177" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_299 #AT_START_300 at_fn_group_banner 300 'headers.at:178' \ "Sane headers: %locations %debug" " " 13 at_xfail=no ( printf "%s\n" "300. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: X { printf ("x\n"); } ; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {X, 0}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:178: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:178" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:178: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:178" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:178: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:178" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:178: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:178" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:178: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:178" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:178: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:178" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:178" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:178" { set +x printf "%s\n" "$at_srcdir/headers.at:178: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:178" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:178" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:178" { set +x printf "%s\n" "$at_srcdir/headers.at:178: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:178" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:178" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_300 #AT_START_301 at_fn_group_banner 301 'headers.at:180' \ "Sane headers: %glr-parser" " " 13 at_xfail=no ( printf "%s\n" "301. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %glr-parser %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: X { printf ("x\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {X, 0}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:180: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:180" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:180: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:180" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:180: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:180" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:180: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:180" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:180: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:180" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:180: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:180" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:180" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:180" { set +x printf "%s\n" "$at_srcdir/headers.at:180: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:180" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:180" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:180" { set +x printf "%s\n" "$at_srcdir/headers.at:180: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:180" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:180" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_301 #AT_START_302 at_fn_group_banner 302 'headers.at:181' \ "Sane headers: %locations %debug %glr-parser" " " 13 at_xfail=no ( printf "%s\n" "302. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %glr-parser %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: X { printf ("x\n"); } ; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {X, 0}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:181: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:181" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:181: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:181" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:181: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:181" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:181" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:181" { set +x printf "%s\n" "$at_srcdir/headers.at:181: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:181" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:181" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:181" { set +x printf "%s\n" "$at_srcdir/headers.at:181: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:181" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:181" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_302 #AT_START_303 at_fn_group_banner 303 'headers.at:183' \ "Sane headers: api.pure" " " 13 at_xfail=no ( printf "%s\n" "303. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.pure %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %% exp: X { printf ("x\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (YYSTYPE *lvalp) { static int const input[] = {X, 0}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:183: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:183" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:183: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:183" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:183: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:183" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:183: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:183" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:183: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:183" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:183: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:183" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:183" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:183" { set +x printf "%s\n" "$at_srcdir/headers.at:183: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:183" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:183" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:183" { set +x printf "%s\n" "$at_srcdir/headers.at:183: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:183" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:183" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_303 #AT_START_304 at_fn_group_banner 304 'headers.at:184' \ "Sane headers: api.push-pull=both" " " 13 at_xfail=no ( printf "%s\n" "304. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.push-pull both %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #if defined __GNUC__ && (7 == __GNUC__ || 9 == __GNUC__) # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: X { printf ("x\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {X, 0}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:184: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:184" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:184: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:184" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:184: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:184" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:184: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:184" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:184: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:184" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:184: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:184" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:184" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:184" { set +x printf "%s\n" "$at_srcdir/headers.at:184: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:184" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:184" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:184" { set +x printf "%s\n" "$at_srcdir/headers.at:184: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:184" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:184" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_304 #AT_START_305 at_fn_group_banner 305 'headers.at:185' \ "Sane headers: api.pure api.push-pull=both" " " 13 at_xfail=no ( printf "%s\n" "305. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.pure %define api.push-pull both %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ #if defined __GNUC__ && (7 == __GNUC__ || 9 == __GNUC__) # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %% exp: X { printf ("x\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (YYSTYPE *lvalp) { static int const input[] = {X, 0}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:185: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:185" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:185: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y" "headers.at:185" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:185: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:185" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:185: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:185" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:185: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:185" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:185: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y" at_fn_check_prepare_trace "headers.at:185" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:185" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:185" { set +x printf "%s\n" "$at_srcdir/headers.at:185: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "headers.at:185" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.h do # No shell expansion with AT_DATA. cat >$h.c < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:185" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:185" { set +x printf "%s\n" "$at_srcdir/headers.at:185: \$CC \$CFLAGS \$CPPFLAGS -c -o \$h.o \$h.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c " "headers.at:185" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o $h.o $h.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:185" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_305 #AT_START_306 at_fn_group_banner 306 'headers.at:187' \ "Sane headers: c++" " " 13 at_xfail=no ( printf "%s\n" "306. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "c++" %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ static int yylex (yy::parser::value_type *lvalp); } %% exp: X { printf ("x\n"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = {yy::parser::token::X, 0}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:187: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:187" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:187: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" "headers.at:187" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:187: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:187" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:187: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:187" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:187: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:187" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:187: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y" at_fn_check_prepare_trace "headers.at:187" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:187" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:187" { set +x printf "%s\n" "$at_srcdir/headers.at:187: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o input.o input.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc " "headers.at:187" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.hh do # No shell expansion with AT_DATA. cat >$h.cc < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:187" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:187" { set +x printf "%s\n" "$at_srcdir/headers.at:187: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o \$h.o \$h.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc " "headers.at:187" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:187" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_306 #AT_START_307 at_fn_group_banner 307 'headers.at:188' \ "Sane headers: %locations %debug c++" " " 13 at_xfail=no ( printf "%s\n" "307. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %language "c++" %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: X { printf ("x\n"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int const input[] = {yy::parser::token::X, 0}; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:188: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:188" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:188: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" "headers.at:188" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:188: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:188" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:188: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:188" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:188: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:188" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:188: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y" at_fn_check_prepare_trace "headers.at:188" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:188" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:188" { set +x printf "%s\n" "$at_srcdir/headers.at:188: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o input.o input.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc " "headers.at:188" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.hh do # No shell expansion with AT_DATA. cat >$h.cc < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:188" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:188" { set +x printf "%s\n" "$at_srcdir/headers.at:188: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o \$h.o \$h.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc " "headers.at:188" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:188" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_307 #AT_START_308 at_fn_group_banner 308 'headers.at:189' \ "Sane headers: c++ api.value.type=variant parse.assert" "" 13 at_xfail=no ( printf "%s\n" "308. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "c++" %define api.value.type variant %define parse.assert %define parse.error verbose %token X %code { #include /* printf. */ static int yylex (yy::parser::value_type *lvalp); } %% exp: X { printf ("x\n"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = {yy::parser::token::X, 0}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:189: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:189" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:189: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" "headers.at:189" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:189: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:189" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:189: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:189" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:189: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:189" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:189: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y" at_fn_check_prepare_trace "headers.at:189" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:189" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:189" { set +x printf "%s\n" "$at_srcdir/headers.at:189: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o input.o input.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc " "headers.at:189" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.hh do # No shell expansion with AT_DATA. cat >$h.cc < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:189" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:189" { set +x printf "%s\n" "$at_srcdir/headers.at:189: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o \$h.o \$h.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc " "headers.at:189" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:189" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_308 #AT_START_309 at_fn_group_banner 309 'headers.at:191' \ "Sane headers: %locations c++ %glr-parser" " " 13 at_xfail=no ( printf "%s\n" "309. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %language "c++" %glr-parser %define parse.error verbose %union {int integer;} %token X %code { #include /* printf. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: X { printf ("x\n"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int const input[] = {yy::parser::token::X, 0}; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y" "headers.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:191: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:191" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y" at_fn_check_prepare_trace "headers.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:191" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:191" { set +x printf "%s\n" "$at_srcdir/headers.at:191: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o input.o input.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc " "headers.at:191" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o input.o input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF # Check that the headers are self-contained, and protected against # multiple inclusions. While at it, check they are sane for C++. for h in *.hh do # No shell expansion with AT_DATA. cat >$h.cc < #include "$h" #include "$h" EOF printf "%s\n" "headers.at:191" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:191" { set +x printf "%s\n" "$at_srcdir/headers.at:191: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o \$h.o \$h.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc " "headers.at:191" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o $h.o $h.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:191" $at_failed && at_fn_log_failure $at_traceon; } done set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_309 #AT_START_310 at_fn_group_banner 310 'headers.at:199' \ "Several parsers" " " 13 at_xfail=no ( printf "%s\n" "310. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST([PREFIX], [DIRECTIVES]) # ------------------------------- # Generate and compile to *.o. Make sure there is no (allowed) YY* # nor yy* identifiers in the header after applying api.prefix. Check # that headers can be compiled by a C++ compiler. # # They should all use parse.assert to make sure that we don't even # conflict of YY_ASSERT. # AT_TEST cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include // If we are compiling with CC=$CXX, then do not load the C headers // inside extern "C", since they were _not_ compiled this way. #if ! CC_IS_CXX extern "C" { #endif #include "x1.h" #include "x2.h" #include "x3.h" #include "x4.h" #include "x6.h" #include "x7.h" #include "x8.h" #if ! CC_IS_CXX } #endif #include "x5.hh" #include "x9.hh" #include "xa.hh" #include "xb.hh" #include "xc.hh" #include "xd.hh" #define RUN(S) \ do { \ int res = S; \ if (res) \ std::cerr << #S": " << res << '\n'; \ } while (false) int main (void) { RUN(x1_parse()); RUN(x2_parse()); RUN(x3_parse()); RUN(x4_parse()); x5_::parser p5; RUN(p5.parse()); RUN(x6_parse()); RUN(x7_parse()); RUN(x8_parse()); x9_::parser p9; RUN(p9.parse()); xa_::parser pa; RUN(pa.parse()); xb_::parser pb; RUN(pb.parse()); xc_::parser pc; RUN(pc.parse()); xd_::parser pd; RUN(pd.parse()); return 0; } _ATEOF # main.cc cat >x1.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x1_} %define parse.assert %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #include /* !POSIX */ static void x1_error (const char *msg); static int x1_lex (void); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void x1_error (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int x1_lex (void) { static char const input[] = "x1"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:320: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x1.c x1.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:320" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x1.c x1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:320: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x1.c x1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x1.c x1.y" "headers.at:320" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x1.c x1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:320: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:320" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:320: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:320" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:320: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:320" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:320: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x1.c x1.y" at_fn_check_prepare_trace "headers.at:320" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x1.c x1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:320" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:320" { set +x printf "%s\n" "$at_srcdir/headers.at:320: \$CC \$CFLAGS \$CPPFLAGS -c -o x1.o x1.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x1.o x1.c " "headers.at:320" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x1.o x1.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:320: echo \"x1\" >>expout" at_fn_check_prepare_trace "headers.at:320" ( $at_check_trace; echo "x1" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:320" $at_failed && at_fn_log_failure $at_traceon; } cat >x2.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x2_} %define parse.assert %locations %debug %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #include #if defined X2_LTYPE_IS_TRIVIAL && X2_LTYPE_IS_TRIVIAL static int location_print (FILE *yyo, X2_LTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void x2_error (const char *msg); static int x2_lex (void); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% # if defined X2_LTYPE_IS_TRIVIAL && X2_LTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, X2_LTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void x2_error (const char *msg) { LOCATION_PRINT (stderr, (x2_lloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int x2_lex (void) { static char const input[] = "x2"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (x2_lloc).first_line = (x2_lloc).last_line = 1; (x2_lloc).first_column = (x2_lloc).last_column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:321: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x2.c x2.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:321" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x2.c x2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:321: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x2.c x2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x2.c x2.y" "headers.at:321" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x2.c x2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:321: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:321" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:321: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:321" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:321: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:321" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:321: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x2.c x2.y" at_fn_check_prepare_trace "headers.at:321" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x2.c x2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:321" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:321" { set +x printf "%s\n" "$at_srcdir/headers.at:321: \$CC \$CFLAGS \$CPPFLAGS -c -o x2.o x2.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x2.o x2.c " "headers.at:321" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x2.o x2.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:321: echo \"x2\" >>expout" at_fn_check_prepare_trace "headers.at:321" ( $at_check_trace; echo "x2" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:321" $at_failed && at_fn_log_failure $at_traceon; } cat >x3.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x3_} %define parse.assert %glr-parser %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #include /* !POSIX */ static void x3_error (const char *msg); static int x3_lex (void); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void x3_error (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int x3_lex (void) { static char const input[] = "x3"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x3.c x3.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x3.c x3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x3.c x3.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x3.c x3.y" "headers.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x3.c x3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:322: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:322" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:322: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:322" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:322: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:322" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:322: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x3.c x3.y" at_fn_check_prepare_trace "headers.at:322" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x3.c x3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:322" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:322" { set +x printf "%s\n" "$at_srcdir/headers.at:322: \$CC \$CFLAGS \$CPPFLAGS -c -o x3.o x3.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x3.o x3.c " "headers.at:322" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x3.o x3.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:322: echo \"x3\" >>expout" at_fn_check_prepare_trace "headers.at:322" ( $at_check_trace; echo "x3" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:322" $at_failed && at_fn_log_failure $at_traceon; } cat >x4.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x4_} %define parse.assert %locations %debug %glr-parser %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #include #if defined X4_LTYPE_IS_TRIVIAL && X4_LTYPE_IS_TRIVIAL static int location_print (FILE *yyo, X4_LTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void x4_error (const char *msg); static int x4_lex (void); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% # if defined X4_LTYPE_IS_TRIVIAL && X4_LTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, X4_LTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void x4_error (const char *msg) { LOCATION_PRINT (stderr, (x4_lloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int x4_lex (void) { static char const input[] = "x4"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (x4_lloc).first_line = (x4_lloc).last_line = 1; (x4_lloc).first_column = (x4_lloc).last_column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:323: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x4.c x4.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:323" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x4.c x4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:323: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x4.c x4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x4.c x4.y" "headers.at:323" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x4.c x4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:323: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:323" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:323: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:323" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:323: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:323" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:323: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x4.c x4.y" at_fn_check_prepare_trace "headers.at:323" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x4.c x4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:323" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:323" { set +x printf "%s\n" "$at_srcdir/headers.at:323: \$CC \$CFLAGS \$CPPFLAGS -c -o x4.o x4.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x4.o x4.c " "headers.at:323" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x4.o x4.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:323: echo \"x4\" >>expout" at_fn_check_prepare_trace "headers.at:323" ( $at_check_trace; echo "x4" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:323" $at_failed && at_fn_log_failure $at_traceon; } cat >x5.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x5_} %define parse.assert %locations %debug %language "c++" %define parse.error verbose %union {int integer;} %code { #include /* printf. */ static int x5_lex (x5_::parser::value_type *lvalp, x5_::parser::location_type *llocp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C++ error reporting function. */ void x5_::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int x5_lex (x5_::parser::value_type *lvalp, x5_::parser::location_type *llocp) { static char const input[] = "x5"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:324: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x5.cc x5.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:324" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x5.cc x5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:324: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x5.cc x5.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x5.cc x5.y" "headers.at:324" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x5.cc x5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:324: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:324" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:324: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:324" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:324: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:324" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:324: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x5.cc x5.y" at_fn_check_prepare_trace "headers.at:324" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x5.cc x5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:324" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:324" { set +x printf "%s\n" "$at_srcdir/headers.at:324: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o x5.o x5.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o x5.o x5.cc " "headers.at:324" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o x5.o x5.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:324: echo \"x5\" >>expout" at_fn_check_prepare_trace "headers.at:324" ( $at_check_trace; echo "x5" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:324" $at_failed && at_fn_log_failure $at_traceon; } cat >x6.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x6_} %define parse.assert %define api.pure %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #include /* !POSIX */ static void x6_error (const char *msg); static int x6_lex (X6_STYPE *lvalp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void x6_error (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int x6_lex (X6_STYPE *lvalp) { static char const input[] = "x6"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x6.c x6.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x6.c x6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x6.c x6.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x6.c x6.y" "headers.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x6.c x6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:325: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:325" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:325: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:325" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:325: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:325" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:325: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x6.c x6.y" at_fn_check_prepare_trace "headers.at:325" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x6.c x6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:325" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:325" { set +x printf "%s\n" "$at_srcdir/headers.at:325: \$CC \$CFLAGS \$CPPFLAGS -c -o x6.o x6.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x6.o x6.c " "headers.at:325" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x6.o x6.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:325: echo \"x6\" >>expout" at_fn_check_prepare_trace "headers.at:325" ( $at_check_trace; echo "x6" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:325" $at_failed && at_fn_log_failure $at_traceon; } cat >x7.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x7_} %define parse.assert %define api.push-pull both %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #if defined __GNUC__ && (7 == __GNUC__ || 9 == __GNUC__) # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include /* !POSIX */ static void x7_error (const char *msg); static int x7_lex (void); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void x7_error (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int x7_lex (void) { static char const input[] = "x7"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x7.c x7.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x7.c x7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x7.c x7.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x7.c x7.y" "headers.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x7.c x7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x7.c x7.y" at_fn_check_prepare_trace "headers.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x7.c x7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:326" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:326" { set +x printf "%s\n" "$at_srcdir/headers.at:326: \$CC \$CFLAGS \$CPPFLAGS -c -o x7.o x7.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x7.o x7.c " "headers.at:326" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x7.o x7.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:326: echo \"x7\" >>expout" at_fn_check_prepare_trace "headers.at:326" ( $at_check_trace; echo "x7" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:326" $at_failed && at_fn_log_failure $at_traceon; } cat >x8.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x8_} %define parse.assert %define api.pure %define api.push-pull both %define parse.error verbose %union {int integer;} %code { #include /* printf. */ #if defined __GNUC__ && (7 == __GNUC__ || 9 == __GNUC__) # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include /* !POSIX */ static void x8_error (const char *msg); static int x8_lex (X8_STYPE *lvalp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void x8_error (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int x8_lex (X8_STYPE *lvalp) { static char const input[] = "x8"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x8.c x8.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x8.c x8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x8.c x8.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x8.c x8.y" "headers.at:327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x8.c x8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:327: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:327" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:327: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:327" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:327: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:327" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:327: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x8.c x8.y" at_fn_check_prepare_trace "headers.at:327" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x8.c x8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:327" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:327" { set +x printf "%s\n" "$at_srcdir/headers.at:327: \$CC \$CFLAGS \$CPPFLAGS -c -o x8.o x8.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o x8.o x8.c " "headers.at:327" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o x8.o x8.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:327: echo \"x8\" >>expout" at_fn_check_prepare_trace "headers.at:327" ( $at_check_trace; echo "x8" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:327" $at_failed && at_fn_log_failure $at_traceon; } cat >x9.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {x9_} %define parse.assert %locations %code requires {#include "location.hh"} %define api.location.type {::x5_::location} %debug %language "c++" %define parse.error verbose %union {int integer;} %code { #include /* printf. */ static int x9_lex (x9_::parser::value_type *lvalp, x9_::parser::location_type *llocp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C++ error reporting function. */ void x9_::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int x9_lex (x9_::parser::value_type *lvalp, x9_::parser::location_type *llocp) { static char const input[] = "x9"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o x9.cc x9.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o x9.cc x9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x9.cc x9.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x9.cc x9.y" "headers.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o x9.cc x9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:328: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:328" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:328: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:328" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:328: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:328" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:328: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x9.cc x9.y" at_fn_check_prepare_trace "headers.at:328" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o x9.cc x9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:328" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:328" { set +x printf "%s\n" "$at_srcdir/headers.at:328: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o x9.o x9.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o x9.o x9.cc " "headers.at:328" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o x9.o x9.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:328: echo \"x9\" >>expout" at_fn_check_prepare_trace "headers.at:328" ( $at_check_trace; echo "x9" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:328" $at_failed && at_fn_log_failure $at_traceon; } cat >xa.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {xa_} %define parse.assert %locations %code requires {#include "location.hh"} %define api.location.type {::x5_::location} %language "c++" %define api.value.type variant %define parse.error verbose %code { #include /* printf. */ static int xa_lex (xa_::parser::value_type *lvalp, xa_::parser::location_type *llocp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C++ error reporting function. */ void xa_::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int xa_lex (xa_::parser::value_type *lvalp, xa_::parser::location_type *llocp) { static char const input[] = "xa"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o xa.cc xa.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o xa.cc xa.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xa.cc xa.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xa.cc xa.y" "headers.at:329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xa.cc xa.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:329: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:329" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:329: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:329" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:329: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:329" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xa.cc xa.y" at_fn_check_prepare_trace "headers.at:329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xa.cc xa.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:329" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:329" { set +x printf "%s\n" "$at_srcdir/headers.at:329: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o xa.o xa.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o xa.o xa.cc " "headers.at:329" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o xa.o xa.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:329: echo \"xa\" >>expout" at_fn_check_prepare_trace "headers.at:329" ( $at_check_trace; echo "xa" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:329" $at_failed && at_fn_log_failure $at_traceon; } cat >xb.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {xb_} %define parse.assert %locations %define api.location.file none %language "c++" %define api.value.type variant %define parse.error verbose %code { #include /* printf. */ static int xb_lex (xb_::parser::value_type *lvalp, xb_::parser::location_type *llocp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C++ error reporting function. */ void xb_::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int xb_lex (xb_::parser::value_type *lvalp, xb_::parser::location_type *llocp) { static char const input[] = "xb"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o xb.cc xb.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o xb.cc xb.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xb.cc xb.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xb.cc xb.y" "headers.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xb.cc xb.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:330: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:330" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:330: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:330" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:330: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:330" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xb.cc xb.y" at_fn_check_prepare_trace "headers.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xb.cc xb.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:330" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:330" { set +x printf "%s\n" "$at_srcdir/headers.at:330: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o xb.o xb.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o xb.o xb.cc " "headers.at:330" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o xb.o xb.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:330: echo \"xb\" >>expout" at_fn_check_prepare_trace "headers.at:330" ( $at_check_trace; echo "xb" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:330" $at_failed && at_fn_log_failure $at_traceon; } cat >xc.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {xc_} %define parse.assert %locations %code requires {#include "location.hh"} %define api.location.type {::x5_::location} %skeleton "glr2.cc" %define parse.error verbose %union {int integer;} %code { #include /* printf. */ static int xc_lex (xc_::parser::value_type *lvalp, xc_::parser::location_type *llocp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C++ error reporting function. */ void xc_::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int xc_lex (xc_::parser::value_type *lvalp, xc_::parser::location_type *llocp) { static char const input[] = "xc"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:331: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o xc.cc xc.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:331" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o xc.cc xc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:331: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xc.cc xc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xc.cc xc.y" "headers.at:331" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xc.cc xc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:331: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:331" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:331: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:331" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:331: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:331" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:331: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xc.cc xc.y" at_fn_check_prepare_trace "headers.at:331" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xc.cc xc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:331" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:331" printf "%s\n" "headers.at:331" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:331" { set +x printf "%s\n" "$at_srcdir/headers.at:331: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS -c -o xc.o xc.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS -c -o xc.o xc.cc " "headers.at:331" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS -c -o xc.o xc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:331: echo \"xc\" >>expout" at_fn_check_prepare_trace "headers.at:331" ( $at_check_trace; echo "xc" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:331" $at_failed && at_fn_log_failure $at_traceon; } cat >xd.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define api.prefix {xd_} %define parse.assert %locations %define api.location.file none %skeleton "glr2.cc" %define parse.error verbose %union {int integer;} %code { #include /* printf. */ static int xd_lex (xd_::parser::value_type *lvalp, xd_::parser::location_type *llocp); } %% exp: 'x' '1' { printf ("x1\n"); } | 'x' '2' { printf ("x2\n"); } | 'x' '3' { printf ("x3\n"); } | 'x' '4' { printf ("x4\n"); } | 'x' '5' { printf ("x5\n"); } | 'x' '6' { printf ("x6\n"); } | 'x' '7' { printf ("x7\n"); } | 'x' '8' { printf ("x8\n"); } | 'x' '9' { printf ("x9\n"); } | 'x' 'a' { printf ("xa\n"); } | 'x' 'b' { printf ("xb\n"); } | 'x' 'c' { printf ("xc\n"); } | 'x' 'd' { printf ("xd\n"); } ; %% /* A C++ error reporting function. */ void xd_::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int xd_lex (xd_::parser::value_type *lvalp, xd_::parser::location_type *llocp) { static char const input[] = "xd"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/headers.at:332: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -o xd.cc xd.y" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:332" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -o xd.cc xd.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:332: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xd.cc xd.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xd.cc xd.y" "headers.at:332" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -o xd.cc xd.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/headers.at:332: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:332" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/headers.at:332: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "headers.at:332" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/headers.at:332: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "headers.at:332" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/headers.at:332: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xd.cc xd.y" at_fn_check_prepare_trace "headers.at:332" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -o xd.cc xd.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:332" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:332" printf "%s\n" "headers.at:332" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:332" { set +x printf "%s\n" "$at_srcdir/headers.at:332: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS -c -o xd.o xd.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS -c -o xd.o xd.cc " "headers.at:332" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS -c -o xd.o xd.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:332: echo \"xd\" >>expout" at_fn_check_prepare_trace "headers.at:332" ( $at_check_trace; echo "xd" >>expout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:332" $at_failed && at_fn_log_failure $at_traceon; } # Check that api.prefix works properly: # # - no 'yy' left. # C++ output relies on namespaces and still uses yy a lot. # # - no 'YY' left. # Ignore YYPUSH_MORE(_DEFINED)? (constant definition), # YYDEBUG (not renamed) can be read, but not changed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/headers.at:342: \"\$PERL\" -n -0777 -e ' # Ignore comments. s{/\\*.*?\\*/}{}gs; s{//.*}{}g; # Ignore warnings. s{# *pragma .* message \".*\"}{}g; s{\\b((defined|if)\\ YYDEBUG |YYChar # Template parameter. |YYNTOKENS # This is actually scoped in a C++ class. |YYPUSH_MORE(?:_DEFINED)? |S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped. |YY(?:_REINTERPRET)?_CAST |YY_ATTRIBUTE(?:_PURE|_UNUSED) |YY_CONSTEXPR |YY_COPY |YY_CPLUSPLUS |YY_IGNORE_(?:MAYBE_UNINITIALIZED|USELESS_CAST)_(?:BEGIN|END) |YY_INITIAL_VALUE |YY_MOVE |YY_MOVE_OR_COPY |YY_MOVE_REF |YY_NOEXCEPT |YY_NOTHROW |YY_NULLPTR |YY_RVREF |YY_USE |YY_\\w+_INCLUDED # Header guards. |FILE\\ \\*yyo # Function argument. |const\\ yylocp # Function argument. )\\b}{}gx; while (/^(.*YY.*)\$/gm) { print \"\$ARGV: invalid exported YY: \$1\\n\"; } if (\$ARGV =~ /\\.h\$/) { while (/^(.*yy.*)\$/gm) { print \"\$ARGV: invalid exported yy: \$1\\n\"; } } ' -- *.hh *.h" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:342" ( $at_check_trace; "$PERL" -n -0777 -e ' # Ignore comments. s{/\*.*?\*/}{}gs; s{//.*}{}g; # Ignore warnings. s{# *pragma .* message ".*"}{}g; s{\b((defined|if)\ YYDEBUG |YYChar # Template parameter. |YYNTOKENS # This is actually scoped in a C++ class. |YYPUSH_MORE(?:_DEFINED)? |S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped. |YY(?:_REINTERPRET)?_CAST |YY_ATTRIBUTE(?:_PURE|_UNUSED) |YY_CONSTEXPR |YY_COPY |YY_CPLUSPLUS |YY_IGNORE_(?:MAYBE_UNINITIALIZED|USELESS_CAST)_(?:BEGIN|END) |YY_INITIAL_VALUE |YY_MOVE |YY_MOVE_OR_COPY |YY_MOVE_REF |YY_NOEXCEPT |YY_NOTHROW |YY_NULLPTR |YY_RVREF |YY_USE |YY_\w+_INCLUDED # Header guards. |FILE\ \*yyo # Function argument. |const\ yylocp # Function argument. )\b}{}gx; while (/^(.*YY.*)$/gm) { print "$ARGV: invalid exported YY: $1\n"; } if ($ARGV =~ /\.h$/) { while (/^(.*yy.*)$/gm) { print "$ARGV: invalid exported yy: $1\n"; } } ' -- *.hh *.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:342" $at_failed && at_fn_log_failure $at_traceon; } fi # Do this late, so that other checks have been performed. cat >c-and-cxx.h <<'_ATEOF' #ifdef __cplusplus extern "C" { #endif int fortytwo (void); #ifdef __cplusplus } #endif _ATEOF cat >c-only.c <<'_ATEOF' #include "c-and-cxx.h" int main (void) { return fortytwo () == 42 ? 0 : 1; } _ATEOF cat >cxx-only.cc <<'_ATEOF' #include "c-and-cxx.h" int fortytwo () { return 42; } _ATEOF printf "%s\n" "headers.at:387" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:387" { set +x printf "%s\n" "$at_srcdir/headers.at:387: \$CC \$CFLAGS \$CPPFLAGS -c -o c-only.o c-only.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o c-only.o c-only.c " "headers.at:387" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o c-only.o c-only.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:387" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "headers.at:387" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:387" { set +x printf "%s\n" "$at_srcdir/headers.at:387: \$CXX \$CPPFLAGS \$CXXFLAGS -c -o cxx-only.o cxx-only.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -c -o cxx-only.o cxx-only.cc " "headers.at:387" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -c -o cxx-only.o cxx-only.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:387: \$CXX \$CXXFLAGS \$CPPFLAGS \$LDFLAGS c-only.o cxx-only.o -o c-and-cxx || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "headers.at:387" ( $at_check_trace; $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS c-only.o cxx-only.o -o c-and-cxx || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:387: \$PREPARSER ./c-and-cxx" at_fn_check_prepare_dynamic " $PREPARSER ./c-and-cxx" "headers.at:387" ( $at_check_trace; $PREPARSER ./c-and-cxx ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "headers.at:387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:387" $at_failed && at_fn_log_failure $at_traceon; } # The header generated by glr2.cc requires C++11. Push the options to # prepare AT_COMPILE_CXX. printf "%s\n" "headers.at:392" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:392" printf "%s\n" "headers.at:392" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/headers.at:392" { set +x printf "%s\n" "$at_srcdir/headers.at:392: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o parser x[1-9a-d].o -DCC_IS_CXX=\$CC_IS_CXX main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o parser x[1-9a-d].o -DCC_IS_CXX=$CC_IS_CXX main.cc $LIBS" "headers.at:392" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o parser x[1-9a-d].o -DCC_IS_CXX=$CC_IS_CXX main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/headers.at:392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:394: \$PREPARSER ./parser" at_fn_check_prepare_dynamic " $PREPARSER ./parser" "headers.at:394" ( $at_check_trace; $PREPARSER ./parser ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/headers.at:394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "headers.at:394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/headers.at:394" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_310 #AT_START_311 at_fn_group_banner 311 'actions.at:24' \ "Midrule actions" " " 14 at_xfail=no ( printf "%s\n" "311. $at_setup_line: testing $at_desc ..." $at_traceon # Bison once forgot the midrule actions. It was because the action # was attached to the host rule (the one with the midrule action), # instead of being attached to the empty rule dedicated to this # action. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: { putchar ('0'); } '1' { putchar ('1'); } '2' { putchar ('2'); } '3' { putchar ('3'); } '4' { putchar ('4'); } '5' { putchar ('5'); } '6' { putchar ('6'); } '7' { putchar ('7'); } '8' { putchar ('8'); } '9' { putchar ('9'); } { putchar ('\n'); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "123456789"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:59: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:59" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:59" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:59: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" "actions.at:59" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:59" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:59: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:59" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:59" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:59: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:59" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:59" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:59: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:59" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:59" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:59: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y" at_fn_check_prepare_trace "actions.at:59" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:59" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:60" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:60" { set +x printf "%s\n" "$at_srcdir/actions.at:60: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:60" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:60" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:61: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:61" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0123456789 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:61" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:61: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:61" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:61" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_311 #AT_START_312 at_fn_group_banner 312 'actions.at:72' \ "Typed midrule actions" " " 14 at_xfail=no ( printf "%s\n" "312. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %union { int ival; } %type exp %% exp: { $$ = 0; } '1' { $$ = 1; } '2' { $$ = 2; } '3' { $$ = 3; } '4' { $$ = 4; } '5' { $$ = 5; } '6' { $$ = 6; } '7' { $$ = 7; } '8' { $$ = 8; } '9' { $$ = 9; } { $$ = 10; } { $$ = 11; } { $$ = $1 + $3 + $5 + $7 + $9 + $11 + $13 + $15 + $17 + $19 + $20 + $21; printf ("%d\n", $$); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "123456789"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:109: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:109" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:109" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:109: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" "actions.at:109" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:109" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:109: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:109" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:109" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:109: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:109" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:109" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:109: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:109" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:109" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:109: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y" at_fn_check_prepare_trace "actions.at:109" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:109" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:110" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:110" { set +x printf "%s\n" "$at_srcdir/actions.at:110: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:110" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:110" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:111: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:111" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "66 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:111" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:111: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:111" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:111" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_312 #AT_START_313 at_fn_group_banner 313 'actions.at:122' \ "Implicitly empty rule" " " 14 at_xfail=no ( printf "%s\n" "313. $at_setup_line: testing $at_desc ..." $at_traceon cat >1.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: a b; a: /* empty. */ {}; // A midrule action does not count as an empty rule. b: {} {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wempty-rule 1.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wempty-rule 1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wempty-rule 1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wempty-rule 1.y" "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wempty-rule 1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:133: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:133" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:133: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:133" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:133: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:133" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y" at_fn_check_prepare_trace "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule] 11 | a: /* empty. */ {}; | ^~ | %empty 1.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y -Werror" "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' 1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule] 11 | a: /* empty. */ {}; | ^~ | %empty 1.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:133: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:133" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y --warnings=error" "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y -Wnone,none -Werror --trace=none" "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:133: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y --warnings=none -Werror --trace=none" "actions.at:133" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -Wempty-rule 1.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:133" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi cat >2.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: a b c; a: /* empty. */ {}; b: %empty {}; c: /* empty. */ {}; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret 2.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret 2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret 2.y" "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:149: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:149" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:149: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:149" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:149: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:149" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret 2.y" at_fn_check_prepare_trace "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule] 11 | a: /* empty. */ {}; | ^~ | %empty 2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule] 13 | c: /* empty. */ {}; | ^~ | %empty 2.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y -Werror" "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' 2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule] 11 | a: /* empty. */ {}; | ^~ | %empty 2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule] 13 | c: /* empty. */ {}; | ^~ | %empty 2.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:149: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:149" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y --warnings=error" "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y -Wnone,none -Werror --trace=none" "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y --warnings=none -Werror --trace=none" "actions.at:149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret 2.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:149" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:161: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -Wno-empty-rule 2.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:161" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -Wno-empty-rule 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:161" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:161: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wno-empty-rule 2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wno-empty-rule 2.y" "actions.at:161" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -Wno-empty-rule 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:161" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:161: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:161" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:161" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:161: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:161" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:161" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:161: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:161" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:161" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:161: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wno-empty-rule 2.y" at_fn_check_prepare_trace "actions.at:161" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -Wno-empty-rule 2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:161" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_313 #AT_START_314 at_fn_group_banner 314 'actions.at:172' \ "Invalid uses of %empty" " " 14 at_xfail=no ( printf "%s\n" "314. $at_setup_line: testing $at_desc ..." $at_traceon cat >one.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: %empty {} %empty ; _ATEOF { set +x printf "%s\n" "$at_srcdir/actions.at:182: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret one.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret one.y" "actions.at:182" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret one.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "one.y:11.13-18: error: only one %empty allowed per rule 11 | %empty {} %empty | ^~~~~~ one.y:11.3-8: note: previous declaration 11 | %empty {} %empty | ^~~~~~ one.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:182" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:192: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -u one.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -u one.y" "actions.at:192" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -u one.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "one.y:11.13-18: error: only one %empty allowed per rule 11 | %empty {} %empty | ^~~~~~ one.y:11.3-8: note: previous declaration 11 | %empty {} %empty | ^~~~~~ bison: file 'one.y' was updated (backup: 'one.y~') " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:192" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:202: sed -e '1,8d' one.y" at_fn_check_prepare_trace "actions.at:202" ( $at_check_trace; sed -e '1,8d' one.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "%% exp: %empty {} ; " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:202" $at_failed && at_fn_log_failure $at_traceon; } cat >two.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %% exp: 'a' %empty {} | %empty 'a' {} | %empty {} {} ; _ATEOF { set +x printf "%s\n" "$at_srcdir/actions.at:219: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret two.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret two.y" "actions.at:219" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret two.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "two.y:11.7-12: error: %empty on non-empty rule 11 | 'a' %empty {} | ^~~~~~ two.y:12.3-8: error: %empty on non-empty rule 12 | | %empty 'a' {} | ^~~~~~ two.y:13.3-8: error: %empty on non-empty rule 13 | | %empty {} {} | ^~~~~~ two.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:219" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_314 #AT_START_315 at_fn_group_banner 315 'actions.at:240' \ "Valid uses of %empty" " " 14 at_xfail=no ( printf "%s\n" "315. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: %empty {} %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:259: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:259" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:259: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:259" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:259: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:259" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:259: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:259" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:259: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:259" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:259: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:259" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:259" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:259" { set +x printf "%s\n" "$at_srcdir/actions.at:259: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:259" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:259" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:260: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:260" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:260" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:260: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:260" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:260" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_315 #AT_START_316 at_fn_group_banner 316 'actions.at:270' \ "Add missing %empty" " " 14 at_xfail=no ( printf "%s\n" "316. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% exp: a b c d e a: {} b:{ }; c: d : e: %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:285: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --update -Wall input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:285" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --update -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:285" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:285: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --update -Wall input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --update -Wall input.y" "actions.at:285" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --update -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:285" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:285: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:285" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:285" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:285: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:285" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:285" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:285: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:285" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:285" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:285: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --update -Wall input.y" at_fn_check_prepare_trace "actions.at:285" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --update -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:285" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:286: cat input.y" at_fn_check_prepare_trace "actions.at:286" ( $at_check_trace; cat input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "%% exp: a b c d e a: %empty {} b: %empty { }; c: %empty d : %empty e: %empty %% " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:286" $at_failed && at_fn_log_failure $at_traceon; } # No warnings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:300: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:300" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:300" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:300: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y" "actions.at:300" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:300" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:300: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:300" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:300" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:300: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:300" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:300" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:300: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:300" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:300" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:300: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall input.y" at_fn_check_prepare_trace "actions.at:300" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:300" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_316 #AT_START_317 at_fn_group_banner 317 'actions.at:365' \ "Initial location: yacc.c " " " 14 at_xfail=no ( printf "%s\n" "317. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (void) { return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:365: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:365" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:365: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:365" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:365: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:365" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:365: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:365" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:365: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:365" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:365: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:365" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:365" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:365" { set +x printf "%s\n" "$at_srcdir/actions.at:365: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:365" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:365: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:365" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:365: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:365" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:365" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_317 #AT_START_318 at_fn_group_banner 318 'actions.at:366' \ "Initial location: yacc.c api.pure=full" " " 14 at_xfail=no ( printf "%s\n" "318. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %define api.pure full %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:366: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:366" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:366: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:366" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:366: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:366" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:366: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:366" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:366: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:366" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:366: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:366" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:366" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:366" { set +x printf "%s\n" "$at_srcdir/actions.at:366: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:366" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:366: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:366" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:366: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:366" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:366" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_318 #AT_START_319 at_fn_group_banner 319 'actions.at:367' \ "Initial location: yacc.c api.pure %parse-param { int x }" "" 14 at_xfail=no ( printf "%s\n" "319. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %define api.pure %parse-param { int x } %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, int x, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, int x, const char *msg) { YY_USE (x); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (0); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:367: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:367" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:367: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:367" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:367: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:367" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:367: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:367" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:367: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:367" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:367: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:367" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:367" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:367" { set +x printf "%s\n" "$at_srcdir/actions.at:367: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:367" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:367: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:367" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:367" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_319 #AT_START_320 at_fn_group_banner 320 'actions.at:368' \ "Initial location: yacc.c api.push-pull=both" " " 14 at_xfail=no ( printf "%s\n" "320. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %define api.push-pull both %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (void) { return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:368: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:368" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:368: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:368" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:368: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:368" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:368" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:368" { set +x printf "%s\n" "$at_srcdir/actions.at:368: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:368" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:368: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:368" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:368" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_320 #AT_START_321 at_fn_group_banner 321 'actions.at:369' \ "Initial location: yacc.c api.push-pull=both api.pure=full" "" 14 at_xfail=no ( printf "%s\n" "321. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %define api.push-pull both %define api.pure full %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:369: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:369" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:369: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:369" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:369: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:369" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:369" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:369" { set +x printf "%s\n" "$at_srcdir/actions.at:369: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:369" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:369: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:369" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:369" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_321 #AT_START_322 at_fn_group_banner 322 'actions.at:370' \ "Initial location: glr.c " " " 14 at_xfail=no ( printf "%s\n" "322. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr.c" %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (void) { return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:370: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:370" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:370: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:370" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:370: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:370" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:370" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:370" { set +x printf "%s\n" "$at_srcdir/actions.at:370: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:370" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:370: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:370" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:370" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_322 #AT_START_323 at_fn_group_banner 323 'actions.at:371' \ "Initial location: glr.c api.pure" " " 14 at_xfail=no ( printf "%s\n" "323. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr.c" %define api.pure %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:371: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:371" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:371: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:371" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:371: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:371" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:371: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:371" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:371: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:371" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:371: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:371" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:371" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:371" { set +x printf "%s\n" "$at_srcdir/actions.at:371: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:371" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:371: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:371" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:371" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_323 #AT_START_324 at_fn_group_banner 324 'actions.at:372' \ "Initial location: lalr1.cc " " " 14 at_xfail=no ( printf "%s\n" "324. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "lalr1.cc" %code { # include # include /* getenv */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: { std::cerr << @$ << '\n'; } %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yy::parser p; p.set_debug_level (!!getenv ("YYDEBUG")); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:372: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:372" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:372: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:372" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:372: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:372" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:372: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:372" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:372" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:372" { set +x printf "%s\n" "$at_srcdir/actions.at:372: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:372" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:372: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:372" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:372: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:372" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:372" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_324 #AT_START_325 at_fn_group_banner 325 'actions.at:373' \ "Initial location: glr.cc " " " 14 at_xfail=no ( printf "%s\n" "325. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr.cc" %code { # include # include /* getenv */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: { std::cerr << @$ << '\n'; } %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yy::parser p; p.set_debug_level (!!getenv ("YYDEBUG")); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:373: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:373" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:373: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:373" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:373: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:373" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:373: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:373" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:373: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:373" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:373: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:373" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:373" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:373" { set +x printf "%s\n" "$at_srcdir/actions.at:373: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:373" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:373: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:373" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:373: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:373" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:373" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_325 #AT_START_326 at_fn_group_banner 326 'actions.at:374' \ "Initial location: glr2.cc " " " 14 at_xfail=no ( printf "%s\n" "326. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr2.cc" %code { # include # include /* getenv */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: { std::cerr << @$ << '\n'; } %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yy::parser p; p.set_debug_level (!!getenv ("YYDEBUG")); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:374: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:374" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:374: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:374" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:374: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:374" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:374" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:374" printf "%s\n" "actions.at:374" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:374" { set +x printf "%s\n" "$at_srcdir/actions.at:374: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:374" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:374: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:374" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "1.1 1.1: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:374" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_326 #AT_START_327 at_fn_group_banner 327 'actions.at:383' \ "Initial location: yacc.c api.pure=full" " " 14 at_xfail=no ( printf "%s\n" "327. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %define api.pure full %{ # define YYLTYPE int # define LOCATION_PRINT(Stream, Loc) \ (void) (Loc) # define YYLLOC_DEFAULT(Current, Rhs, N) \ (Current) = ((Rhs)[N ? 1 : 0]) %} %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:383: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:383" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:383: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:383" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:383: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:383" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:383: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:383" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:383: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:383" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:383: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:383" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:383" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:383" { set +x printf "%s\n" "$at_srcdir/actions.at:383: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:383" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:383: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:383" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:383: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:383" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" " : syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:383" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_327 #AT_START_328 at_fn_group_banner 328 'actions.at:394' \ "Initial location: yacc.c api.pure=full" " " 14 at_xfail=no ( printf "%s\n" "328. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %define api.pure full %{ # define YYLTYPE int # define LOCATION_PRINT(Stream, Loc) \ fprintf ((Stream), "%d", (Loc)) # define YYLLOC_DEFAULT(Current, Rhs, N) \ (Current) = ((Rhs)[N ? 1 : 0]) %} %code { # include # include /* getenv */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% exp: { LOCATION_PRINT(stderr, @$); fputc ('\n', stderr); } %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { YY_USE (lvalp); YY_USE (llocp); return 'x'; } int main (void) { yydebug = !!getenv ("YYDEBUG"); return !!yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:394: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:394" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:394: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:394" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:394: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:394" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:394: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:394" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:394: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:394" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:394: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:394" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:394" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:394" { set +x printf "%s\n" "$at_srcdir/actions.at:394: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:394" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:394: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:394" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "0 0: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:394" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_328 #AT_START_329 at_fn_group_banner 329 'actions.at:478' \ "Location print: yacc.c " " " 14 at_xfail=no ( printf "%s\n" "329. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "yacc.c" %code { #include /* putchar. */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: %empty; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } int main (void) { YYLTYPE loc; #define TEST(L1, C1, L2, C2) \ loc.first_line = L1; \ loc.first_column = C1; \ loc.last_line = L2; \ loc.last_column = C2; \ LOCATION_PRINT(stdout, loc);\ putchar ('\n'); TEST(1, 1, 1, 1); TEST(2, 1, 2, 10); TEST(3, 1, 4, 1); TEST(5, 1, 6, 10); TEST(7, 2, 0, 2); TEST(8, 0, 8, 0); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:478" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:478" { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:478" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:478" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1.1 2.1-9 3.1-4.0 5.1-6.9 7.2 8.0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_329 #AT_START_330 at_fn_group_banner 330 'actions.at:478' \ "Location print: glr.c " " " 14 at_xfail=no ( printf "%s\n" "330. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr.c" %code { #include /* putchar. */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% exp: %empty; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } int main (void) { YYLTYPE loc; #define TEST(L1, C1, L2, C2) \ loc.first_line = L1; \ loc.first_column = C1; \ loc.last_line = L2; \ loc.last_column = C2; \ LOCATION_PRINT(stdout, loc);\ putchar ('\n'); TEST(1, 1, 1, 1); TEST(2, 1, 2, 10); TEST(3, 1, 4, 1); TEST(5, 1, 6, 10); TEST(7, 2, 0, 2); TEST(8, 0, 8, 0); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:478" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:478" { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:478" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:478" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1.1 2.1-9 3.1-4.0 5.1-6.9 7.2 8.0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_330 #AT_START_331 at_fn_group_banner 331 'actions.at:478' \ "Location print: lalr1.cc " " " 14 at_xfail=no ( printf "%s\n" "331. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "lalr1.cc" %code { #include /* putchar. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int main (void) { yy::parser::location_type loc; #define TEST(L1, C1, L2, C2) \ loc.begin.line = L1; \ loc.begin.column = C1; \ loc.end.line = L2; \ loc.end.column = C2; \ std::cout << loc;\ putchar ('\n'); TEST(1, 1, 1, 1); TEST(2, 1, 2, 10); TEST(3, 1, 4, 1); TEST(5, 1, 6, 10); TEST(7, 2, 0, 2); TEST(8, 0, 8, 0); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:478" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:478" { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:478" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:478" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1.1 2.1-9 3.1-4.0 5.1-6.9 7.2 8.0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_331 #AT_START_332 at_fn_group_banner 332 'actions.at:478' \ "Location print: glr.cc " " " 14 at_xfail=no ( printf "%s\n" "332. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr.cc" %code { #include /* putchar. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int main (void) { yy::parser::location_type loc; loc.initialize(); #define TEST(L1, C1, L2, C2) \ loc.begin.line = L1; \ loc.begin.column = C1; \ loc.end.line = L2; \ loc.end.column = C2; \ std::cout << loc;\ putchar ('\n'); TEST(1, 1, 1, 1); TEST(2, 1, 2, 10); TEST(3, 1, 4, 1); TEST(5, 1, 6, 10); TEST(7, 2, 0, 2); TEST(8, 0, 8, 0); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:478" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:478" { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:478" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:478" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1.1 2.1-9 3.1-4.0 5.1-6.9 7.2 8.0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_332 #AT_START_333 at_fn_group_banner 333 'actions.at:478' \ "Location print: glr2.cc " " " 14 at_xfail=no ( printf "%s\n" "333. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %debug %skeleton "glr2.cc" %code { #include /* putchar. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int main (void) { yy::parser::location_type loc; loc.initialize(); #define TEST(L1, C1, L2, C2) \ loc.begin.line = L1; \ loc.begin.column = C1; \ loc.end.line = L2; \ loc.end.column = C2; \ std::cout << loc;\ putchar ('\n'); TEST(1, 1, 1, 1); TEST(2, 1, 2, 10); TEST(3, 1, 4, 1); TEST(5, 1, 6, 10); TEST(7, 2, 0, 2); TEST(8, 0, 8, 0); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:478" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:478" printf "%s\n" "actions.at:478" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:478" { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:478" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:478" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1.1 2.1-9 3.1-4.0 5.1-6.9 7.2 8.0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:478" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_333 #AT_START_334 at_fn_group_banner 334 'actions.at:488' \ "Exotic Dollars" " " 14 at_xfail=no ( printf "%s\n" "334. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(Var) } %union { int val; }; %type a_1 a_2 a_5 sum_of_the_five_previous_values %% exp: a_1 a_2 { $$ = 3; } { $$ = $3 + 1; } a_5 sum_of_the_five_previous_values { USE (($1, $2, $3, $4, $5)); printf ("%d\n", $6); } ; a_1: { $$ = 1; }; a_2: { $$ = 2; }; a_5: { $$ = 5; }; sum_of_the_five_previous_values: { $$ = $0 + $-1 + $-2 + $-3 + $-4; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:532: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -d -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:532" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:532: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y" "actions.at:532" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:532" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:532: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:532" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:532" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:532: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:532" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:532" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:532: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:532" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:532" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:532: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y" at_fn_check_prepare_trace "actions.at:532" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -d -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:532" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:533" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:533" { set +x printf "%s\n" "$at_srcdir/actions.at:533: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:533" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:534: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:534" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "15 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:534" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:534: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:534" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:534" $at_failed && at_fn_log_failure $at_traceon; } # Make sure that fields after $n or $-n are parsed correctly. At one # point while implementing dashes in symbol names, we were dropping # fields after $-n. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); typedef struct { int val; } stype; # define YYSTYPE stype %} %% start: one two { $$.val = $1.val + $2.val; } sum ; one: { $$.val = 1; } ; two: { $$.val = 2; } ; sum: { printf ("%d\n", $0.val + $-1.val + $-2.val); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:562: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:562" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:562: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:562" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:562: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:562" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:562: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:562" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:562: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:562" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:562: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:562" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:562" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:562" { set +x printf "%s\n" "$at_srcdir/actions.at:562: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:562" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:562" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:563: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:563" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "6 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:563" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:563: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:563" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:563" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_334 #AT_START_335 at_fn_group_banner 335 'actions.at:1047' \ "Printers and Destructors" " " 14 at_xfail=no ( printf "%s\n" "335. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).first_line, (Location).last_line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %code { static int yylex (void); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); } /* FIXME: This %printer isn't actually tested. */ %printer { fprintf (yyo, "%d", $$); } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int counter = 0; int c = (yylval) = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (yylloc).first_line = (yylloc).first_column = (10 * c); (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((yylloc))); return source[c]; } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1047: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1047" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1047" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1047" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1047" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1047: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1047" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1047" { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1047" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. { set +x printf "%s\n" "$at_srcdir/actions.at:1047: \$PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'" "actions.at:1047" ( $at_check_trace; $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1047: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1047" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: '(' (6@60-69) sending: 'x' (7@70-79) thing (7@70-79): 'x' (7@70-79) sending: ')' (8@80-89) line (6@60-89): '(' (6@60-69) thing (7@70-79) ')' (8@80-89) sending: '(' (9@90-99) sending: 'x' (10@100-109) thing (10@100-109): 'x' (10@100-109) sending: ')' (11@110-119) line (9@90-119): '(' (9@90-99) thing (10@100-109) ')' (11@110-119) sending: '(' (12@120-129) sending: 'x' (13@130-139) thing (13@130-139): 'x' (13@130-139) sending: ')' (14@140-149) line (12@120-149): '(' (12@120-129) thing (13@130-139) ')' (14@140-149) sending: '(' (15@150-159) sending: 'x' (16@160-169) thing (16@160-169): 'x' (16@160-169) sending: ')' (17@170-179) line (15@150-179): '(' (15@150-159) thing (16@160-169) ')' (17@170-179) sending: '(' (18@180-189) sending: 'x' (19@190-199) thing (19@190-199): 'x' (19@190-199) sending: ')' (20@200-209) 200.200-209.208: memory exhausted Freeing nterm thing (19@190-199) Freeing nterm line (15@150-179) Freeing nterm line (12@120-149) Freeing nterm line (9@90-119) Freeing nterm line (6@60-89) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Parsing FAILED (status 2). " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1047" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_335 #AT_START_336 at_fn_group_banner 336 'actions.at:1048' \ "Printers and Destructors with union" " " 14 at_xfail=no ( printf "%s\n" "336. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).first_line, (Location).last_line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %union { int ival; } %code provides { static int yylex (void); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); } %type '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END /* FIXME: This %printer isn't actually tested. */ %printer { fprintf (yyo, "%d", $$); } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int counter = 0; int c = (yylval).ival = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (yylloc).first_line = (yylloc).first_column = (10 * c); (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((yylloc))); return source[c]; } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1048: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1048" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1048" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1048" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1048" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1048: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1048" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1048" { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1048" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. { set +x printf "%s\n" "$at_srcdir/actions.at:1048: \$PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)'" "actions.at:1048" ( $at_check_trace; $PREPARSER ./input '(x)(x)(x)(x)(x)(x)(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1048: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1048" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: '(' (6@60-69) sending: 'x' (7@70-79) thing (7@70-79): 'x' (7@70-79) sending: ')' (8@80-89) line (6@60-89): '(' (6@60-69) thing (7@70-79) ')' (8@80-89) sending: '(' (9@90-99) sending: 'x' (10@100-109) thing (10@100-109): 'x' (10@100-109) sending: ')' (11@110-119) line (9@90-119): '(' (9@90-99) thing (10@100-109) ')' (11@110-119) sending: '(' (12@120-129) sending: 'x' (13@130-139) thing (13@130-139): 'x' (13@130-139) sending: ')' (14@140-149) line (12@120-149): '(' (12@120-129) thing (13@130-139) ')' (14@140-149) sending: '(' (15@150-159) sending: 'x' (16@160-169) thing (16@160-169): 'x' (16@160-169) sending: ')' (17@170-179) line (15@150-179): '(' (15@150-159) thing (16@160-169) ')' (17@170-179) sending: '(' (18@180-189) sending: 'x' (19@190-199) thing (19@190-199): 'x' (19@190-199) sending: ')' (20@200-209) 200.200-209.208: memory exhausted Freeing nterm thing (19@190-199) Freeing nterm line (15@150-179) Freeing nterm line (12@120-149) Freeing nterm line (9@90-119) Freeing nterm line (6@60-89) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Parsing FAILED (status 2). " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1048" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_336 #AT_START_337 at_fn_group_banner 337 'actions.at:1050' \ "Printers and Destructors: %glr-parser" " " 14 at_xfail=no ( printf "%s\n" "337. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).first_line, (Location).last_line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %glr-parser %code { static int yylex (void); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); } /* FIXME: This %printer isn't actually tested. */ %printer { fprintf (yyo, "%d", $$); } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int counter = 0; int c = (yylval) = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (yylloc).first_line = (yylloc).first_column = (10 * c); (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((yylloc))); return source[c]; } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1050: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1050" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1050" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1050" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1050" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1050: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1050" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1050" { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1050" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1050" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1050" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1050" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1050" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1050" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1050: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1050" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1050: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1050" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1050" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_337 #AT_START_338 at_fn_group_banner 338 'actions.at:1051' \ "Printers and Destructors with union: %glr-parser" "" 14 at_xfail=no ( printf "%s\n" "338. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).first_line, (Location).last_line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %glr-parser %union { int ival; } %code provides { static int yylex (void); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); } %type '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END /* FIXME: This %printer isn't actually tested. */ %printer { fprintf (yyo, "%d", $$); } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int counter = 0; int c = (yylval).ival = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (yylloc).first_line = (yylloc).first_column = (10 * c); (yylloc).last_line = (yylloc).last_column = (yylloc).first_line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((yylloc))); return source[c]; } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1051: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1051" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1051" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1051" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1051" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1051: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1051" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1051" { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1051" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1051" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1051" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1051" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1051" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1051" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1051: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1051" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1051: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1051" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1051" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_338 #AT_START_339 at_fn_group_banner 339 'actions.at:1053' \ "Printers and Destructors: %header lalr1.cc" " " 14 at_xfail=no ( printf "%s\n" "339. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).begin.line, (Location).end.line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %header %skeleton "lalr1.cc" %code { typedef yy::location YYLTYPE; static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* FIXME: This %printer isn't actually tested. */ %printer { yyo << $$;; } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int counter = 0; int c = (*lvalp) = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (*llocp).begin.line = (*llocp).begin.column = (10 * c); (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((*llocp))); return source[c]; } static bool yydebug; int yyparse () { yy::parser parser; parser.set_debug_level (yydebug); return parser.parse (); } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1053: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1053" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1053" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1053" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1053" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1053: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1053" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1053" { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1053" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1053" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1053" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1053" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1053" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1053" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1053: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1053" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1053: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1053" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1053" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_339 #AT_START_340 at_fn_group_banner 340 'actions.at:1054' \ "Printers and Destructors with union: %header lalr1.cc" "" 14 at_xfail=no ( printf "%s\n" "340. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).begin.line, (Location).end.line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %header %skeleton "lalr1.cc" %union { int ival; } %code provides { typedef yy::location YYLTYPE; static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %type '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END /* FIXME: This %printer isn't actually tested. */ %printer { yyo << $$;; } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int counter = 0; int c = (*lvalp).ival = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (*llocp).begin.line = (*llocp).begin.column = (10 * c); (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((*llocp))); return source[c]; } static bool yydebug; int yyparse () { yy::parser parser; parser.set_debug_level (yydebug); return parser.parse (); } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1054: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1054" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1054" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1054" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1054" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1054: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1054" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1054" { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1054" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1054" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1054" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1054" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1054" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1054" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1054: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1054" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1054: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1054" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1054" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_340 #AT_START_341 at_fn_group_banner 341 'actions.at:1056' \ "Printers and Destructors: %header glr.cc" " " 14 at_xfail=no ( printf "%s\n" "341. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).begin.line, (Location).end.line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %header %skeleton "glr.cc" %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* FIXME: This %printer isn't actually tested. */ %printer { yyo << $$;; } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int counter = 0; int c = (*lvalp) = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (*llocp).begin.line = (*llocp).begin.column = (10 * c); (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((*llocp))); return source[c]; } int yyparse () { yy::parser parser; parser.set_debug_level (yydebug); return parser.parse (); } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1056: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1056" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1056" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1056" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1056" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1056: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1056" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1056" { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1056" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1056" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1056" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1056" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1056" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1056" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1056: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1056" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1056: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1056" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1056" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_341 #AT_START_342 at_fn_group_banner 342 'actions.at:1057' \ "Printers and Destructors with union: %header glr.cc" "" 14 at_xfail=no ( printf "%s\n" "342. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).begin.line, (Location).end.line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %header %skeleton "glr.cc" %union { int ival; } %code provides { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %type '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END /* FIXME: This %printer isn't actually tested. */ %printer { yyo << $$;; } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int counter = 0; int c = (*lvalp).ival = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (*llocp).begin.line = (*llocp).begin.column = (10 * c); (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((*llocp))); return source[c]; } int yyparse () { yy::parser parser; parser.set_debug_level (yydebug); return parser.parse (); } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1057: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1057" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1057" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1057" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1057" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1057: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1057" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1057" { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1057" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1057" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1057" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1057" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1057" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1057" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1057: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1057" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1057: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1057" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1057" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_342 #AT_START_343 at_fn_group_banner 343 'actions.at:1059' \ "Printers and Destructors: %header glr2.cc" " " 14 at_xfail=no ( printf "%s\n" "343. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).begin.line, (Location).end.line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %header %skeleton "glr2.cc" %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* FIXME: This %printer isn't actually tested. */ %printer { yyo << $$;; } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int counter = 0; int c = (*lvalp) = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (*llocp).begin.line = (*llocp).begin.column = (10 * c); (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((*llocp))); return source[c]; } int yyparse () { yy::parser parser; parser.set_debug_level (yydebug); return parser.parse (); } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1059: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1059" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1059" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1059" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1059" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1059: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1059" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1059" printf "%s\n" "actions.at:1059" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1059" { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1059" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1059" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1059" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1059" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1059" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1059" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1059: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1059" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1059: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1059" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1059" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_343 #AT_START_344 at_fn_group_banner 344 'actions.at:1060' \ "Printers and Destructors with union: %header glr2.cc" "" 14 at_xfail=no ( printf "%s\n" "344. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure complex $n work. # Be sure to pass all the %directives to this macro to have correct # helping macros. So don't put any directly in the Bison file. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include #include #include #include #define YYINITDEPTH 10 #define YYMAXDEPTH 10 #define RANGE(Location) (Location).begin.line, (Location).end.line #define USE(SYM) /* Display the symbol type Symbol. */ #define V(Symbol, Value, Location, Sep) \ fprintf (stderr, #Symbol " (%d@%d-%d)%s", Value, RANGE(Location), Sep) } %define parse.error verbose %debug %verbose %locations %header %skeleton "glr2.cc" %union { int ival; } %code provides { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %type '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END /* FIXME: This %printer isn't actually tested. */ %printer { yyo << $$;; } '(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END %destructor { fprintf (stderr, "Freeing nterm input (%d@%d-%d)\n", $$, RANGE (@$)); } input %destructor { fprintf (stderr, "Freeing nterm line (%d@%d-%d)\n", $$, RANGE (@$)); } line %destructor { fprintf (stderr, "Freeing nterm thing (%d@%d-%d)\n", $$, RANGE (@$)); } thing %destructor { fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); } raise %destructor { fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); } check-spontaneous-errors %destructor { fprintf (stderr, "Freeing token 'x' (%d@%d-%d)\n", $$, RANGE (@$)); } 'x' %destructor { fprintf (stderr, "Freeing token 'y' (%d@%d-%d)\n", $$, RANGE (@$)); } 'y' %token END 0 %destructor { fprintf (stderr, "Freeing token END (%d@%d-%d)\n", $$, RANGE (@$)); } END %% /* This grammar is made to exercise error recovery. "Lines" starting with '(' support error recovery, with ')' as synchronizing token. Lines starting with 'x' can never be recovered from if in error. */ input: %empty { $$ = 0; V(input, $$, @$, ": /* Nothing */\n"); } | line input /* Right recursive to load the stack so that popping at END can be exercised. */ { $$ = 2; V(input, $$, @$, ": "); V(line, $1, @1, " "); V(input, $2, @2, "\n"); } | '!' check-spontaneous-errors { $$ = $2; } ; check-spontaneous-errors: raise { abort(); USE(($$, $1)); } | '(' raise ')' { abort(); USE(($$, $2)); } | error { $$ = 5; V(check-spontaneous-errors, $$, @$, ": "); fprintf (stderr, "error (@%d-%d)\n", RANGE(@1)); } ; raise: %empty { $$ = 4; V(raise, $$, @$, ": %empty\n"); YYERROR; } | '!' '!' { $$ = 5; V(raise, $$, @$, ": "); V(!, $1, @2, " "); V(!, $2, @2, "\n"); YYERROR; } ; line: thing thing thing ';' { $$ = $1; V(line, $$, @$, ": "); V(thing, $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(;, $4, @4, "\n"); } | '(' thing thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(thing, $3, @3, " "); V(')', $4, @4, "\n"); } | '(' thing ')' { $$ = $1; V(line, $$, @$, ": "); V('(', $1, @1, " "); V(thing, $2, @2, " "); V(')', $3, @3, "\n"); } | '(' error ')' { $$ = -1; V(line, $$, @$, ": "); V('(', $1, @1, " "); fprintf (stderr, "error (@%d-%d) ", RANGE(@2)); V(')', $3, @3, "\n"); } ; thing: 'x' { $$ = $1; V(thing, $$, @$, ": "); V('x', $1, @1, "\n"); } ; %% /* Alias to ARGV[1]. */ const char *source = YY_NULLPTR; /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static int counter = 0; int c = (*lvalp).ival = counter++; assert (c <= YY_CAST (int, strlen (source))); /* As in BASIC, line numbers go from 10 to 10. */ (*llocp).begin.line = (*llocp).begin.column = (10 * c); (*llocp).end.line = (*llocp).end.column = (*llocp).begin.line + 9; if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else fprintf (stderr, "sending: END"); fprintf (stderr, " (%d@%d-%d)\n", c, RANGE ((*llocp))); return source[c]; } int yyparse () { yy::parser parser; parser.set_debug_level (yydebug); return parser.parse (); } int main (int argc, const char *argv[]) { int status; yydebug = !!getenv ("YYDEBUG"); assert (argc == 2); (void) argc; source = argv[1]; status = yyparse (); switch (status) { case 0: fprintf (stderr, "Successful parse.\n"); break; case 1: fprintf (stderr, "Parsing FAILED.\n"); break; default: fprintf (stderr, "Parsing FAILED (status %d).\n", status); break; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1060: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1060" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1060" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1060" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1060" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1060: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1060" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1060" printf "%s\n" "actions.at:1060" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1060" { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1060" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of "empty" # ----------------------------- # I.e., epsilon-reductions, as in "(x)" which ends by reducing # an empty "line" nterm. # FIXME: This location is not satisfying. Depend on the lookahead? { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$PREPARSER ./input '(x)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)'" "actions.at:1060" ( $at_check_trace; $PREPARSER ./input '(x)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (0@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of empty reductions raising an error # ------------------------------------------------------- # Here, the error is after token "!@0-9", so the error is raised from # @9-9, and the error recovery detects that it starts from @9-9 and # ends where starts the next token: END@10-19. # # So error recovery reports error@9-19. { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$PREPARSER ./input '!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!'" "actions.at:1060" ( $at_check_trace; $PREPARSER ./input '!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: END (1@10-19) raise (4@9-9): %empty check-spontaneous-errors (5@9-19): error (@9-19) Freeing token END (1@10-19) Freeing nterm input (5@0-19) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Check the location of not empty reductions raising an error # ----------------------------------------------------------- # This time the error is raised from a rule with 2 rhs symbols: @10-29. # It is recovered @10-29. { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$PREPARSER ./input '!!!'" at_fn_check_prepare_dynamic " $PREPARSER ./input '!!!'" "actions.at:1060" ( $at_check_trace; $PREPARSER ./input '!!!' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '!' (0@0-9) sending: '!' (1@10-19) sending: '!' (2@20-29) raise (5@10-29): ! (1@20-29) ! (2@20-29) check-spontaneous-errors (5@10-29): error (@10-29) sending: END (3@30-39) Freeing token END (3@30-39) Freeing nterm input (5@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Check locations in error recovery # --------------------------------- # '(y)' is an error, but can be recovered from. But what's the location # of the error itself ('y'), and of the resulting reduction ('(error)'). { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$PREPARSER ./input '(y)'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(y)'" "actions.at:1060" ( $at_check_trace; $PREPARSER ./input '(y)' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'y' (1@10-19) 10.10-19.18: syntax error, unexpected 'y', expecting 'x' Freeing token 'y' (1@10-19) sending: ')' (2@20-29) line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29) sending: END (3@30-39) input (0@29-29): /* Nothing */ input (2@0-29): line (-1@0-29) input (0@29-29) Freeing token END (3@30-39) Freeing nterm input (2@0-29) Successful parse. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Syntax errors caught by the parser # ---------------------------------- # Exercise the discarding of stack top and input until 'error' # can be reduced. # # '(', 'x', 'x', 'x', 'x', 'x', ')', # # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'y' { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$PREPARSER ./input '(xxxxx)(x)(x)y'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(xxxxx)(x)(x)y'" "actions.at:1060" ( $at_check_trace; $PREPARSER ./input '(xxxxx)(x)(x)y' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: 'x' (2@20-29) thing (2@20-29): 'x' (2@20-29) sending: 'x' (3@30-39) 30.30-39.38: syntax error, unexpected 'x', expecting ')' Freeing nterm thing (2@20-29) Freeing nterm thing (1@10-19) Freeing token 'x' (3@30-39) sending: 'x' (4@40-49) Freeing token 'x' (4@40-49) sending: 'x' (5@50-59) Freeing token 'x' (5@50-59) sending: ')' (6@60-69) line (-1@0-69): '(' (0@0-9) error (@10-59) ')' (6@60-69) sending: '(' (7@70-79) sending: 'x' (8@80-89) thing (8@80-89): 'x' (8@80-89) sending: ')' (9@90-99) line (7@70-99): '(' (7@70-79) thing (8@80-89) ')' (9@90-99) sending: '(' (10@100-109) sending: 'x' (11@110-119) thing (11@110-119): 'x' (11@110-119) sending: ')' (12@120-129) line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129) sending: 'y' (13@130-139) input (0@129-129): /* Nothing */ input (2@100-129): line (10@100-129) input (0@129-129) input (2@70-129): line (7@70-99) input (2@100-129) input (2@0-129): line (-1@0-69) input (2@70-129) 130.130-139.138: syntax error, unexpected 'y', expecting END Freeing nterm input (2@0-129) Freeing token 'y' (13@130-139) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Syntax error caught by the parser where lookahead = END # -------------------------------------------------------- # Load the stack and provoke an error that cannot be caught by the # grammar, to check that the stack is cleared. And make sure the # lookahead is freed. # # '(', 'x', ')', # '(', 'x', ')', # 'x' { set +x printf "%s\n" "$at_srcdir/actions.at:1060: \$PREPARSER ./input '(x)(x)x'" at_fn_check_prepare_dynamic " $PREPARSER ./input '(x)(x)x'" "actions.at:1060" ( $at_check_trace; $PREPARSER ./input '(x)(x)x' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1060: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1060" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "sending: '(' (0@0-9) sending: 'x' (1@10-19) thing (1@10-19): 'x' (1@10-19) sending: ')' (2@20-29) line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29) sending: '(' (3@30-39) sending: 'x' (4@40-49) thing (4@40-49): 'x' (4@40-49) sending: ')' (5@50-59) line (3@30-59): '(' (3@30-39) thing (4@40-49) ')' (5@50-59) sending: 'x' (6@60-69) thing (6@60-69): 'x' (6@60-69) sending: END (7@70-79) 70.70-79.78: syntax error, unexpected END, expecting 'x' Freeing nterm thing (6@60-69) Freeing nterm line (3@30-59) Freeing nterm line (0@0-29) Freeing token END (7@70-79) Parsing FAILED. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1060" $at_failed && at_fn_log_failure $at_traceon; } # Check destruction upon stack overflow # ------------------------------------- # Upon stack overflow, all symbols on the stack should be destroyed. # Only check for yacc.c. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_344 #AT_START_345 at_fn_group_banner 345 'actions.at:1071' \ "Default tagless %printer and %destructor" " " 14 at_xfail=no ( printf "%s\n" "345. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %locations %code { static int yylex (void); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); # define USE(SYM) } %printer { #error "<*> printer should not be used." } <*> %printer { fprintf (yyo, "<> printer for '%c' @ %d", $$, @$.first_column); } <> %destructor { printf ("<> destructor for '%c' @ %d.\n", $$, @$.first_column); } <> %printer { fprintf (yyo, "'b'/'c' printer for '%c' @ %d", $$, @$.first_column); } 'b' 'c' %destructor { printf ("'b'/'c' destructor for '%c' @ %d.\n", $$, @$.first_column); } 'b' 'c' %destructor { #error "<*> destructor should not be used." } <*> %% start: 'a' 'b' 'c' 'd' 'e' { $$ = 'S'; USE(($1, $2, $3, $4, $5)); } ; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "abcd"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; yylval = res; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1116: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1116" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1116: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1116" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1116: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1116" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:30.3-5: warning: useless %destructor for type <*> [-Wother] input.y:30.3-5: warning: useless %printer for type <*> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:30.3-5: warning: useless %destructor for type <*> [-Wother] input.y:30.3-5: warning: useless %printer for type <*> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1116: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1116" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1116: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "actions.at:1116" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1116" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1120" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1120" { set +x printf "%s\n" "$at_srcdir/actions.at:1120: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1120" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1120" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1121: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1121" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "<> destructor for 'd' @ 4. 'b'/'c' destructor for 'c' @ 3. 'b'/'c' destructor for 'b' @ 2. <> destructor for 'a' @ 1. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1121" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1121: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1121" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reading a token Next token is token 'a' (1.1: <> printer for 'a' @ 1) Shifting token 'a' (1.1: <> printer for 'a' @ 1) Entering state 1 Stack now 0 1 Reading a token Next token is token 'b' (1.2: 'b'/'c' printer for 'b' @ 2) Shifting token 'b' (1.2: 'b'/'c' printer for 'b' @ 2) Entering state 3 Stack now 0 1 3 Reading a token Next token is token 'c' (1.3: 'b'/'c' printer for 'c' @ 3) Shifting token 'c' (1.3: 'b'/'c' printer for 'c' @ 3) Entering state 5 Stack now 0 1 3 5 Reading a token Next token is token 'd' (1.4: <> printer for 'd' @ 4) Shifting token 'd' (1.4: <> printer for 'd' @ 4) Entering state 6 Stack now 0 1 3 5 6 Reading a token Now at end of input. 1.5: syntax error, unexpected end of file, expecting 'e' Error: popping token 'd' (1.4: <> printer for 'd' @ 4) Stack now 0 1 3 5 Error: popping token 'c' (1.3: 'b'/'c' printer for 'c' @ 3) Stack now 0 1 3 Error: popping token 'b' (1.2: 'b'/'c' printer for 'b' @ 2) Stack now 0 1 Error: popping token 'a' (1.1: <> printer for 'a' @ 1) Stack now 0 Cleanup: discarding lookahead token \"end of file\" (1.5: ) Stack now 0 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1121" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_345 #AT_START_346 at_fn_group_banner 346 'actions.at:1174' \ "Default tagged and per-type %printer and %destructor" "" 14 at_xfail=no ( printf "%s\n" "346. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %{ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(SYM) %} %printer { #error "<> printer should not be used." } <> %union { int field0; int field1; int field2; } %type start 'a' 'g' %type 'e' %type 'f' %printer { fprintf (yyo, "<*>//e printer"); } <*> 'e' %destructor { printf ("<*>//e destructor.\n"); } <*> 'e' %type 'b' %printer { fprintf (yyo, " printer"); } %destructor { printf (" destructor.\n"); } %type 'c' %printer { fprintf (yyo, "'c' printer"); } 'c' %destructor { printf ("'c' destructor.\n"); } 'c' %type 'd' %printer { fprintf (yyo, "'d' printer"); } 'd' %destructor { printf ("'d' destructor.\n"); } 'd' %destructor { #error "<> destructor should not be used." } <> %% start: 'a' 'b' 'c' 'd' 'e' 'f' 'g' { USE(($1, $2, $3, $4, $5, $6, $7)); $$ = 'S'; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "abcdef"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1233: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1233" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1233: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1233" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1233: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1233" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:22.3-4: warning: useless %destructor for type <> [-Wother] input.y:22.3-4: warning: useless %printer for type <> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:22.3-4: warning: useless %destructor for type <> [-Wother] input.y:22.3-4: warning: useless %printer for type <> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1233: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1233" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "actions.at:1233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1233" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1237" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1237" { set +x printf "%s\n" "$at_srcdir/actions.at:1237: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1237" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1237" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1238: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1238" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "<*>//e destructor. <*>//e destructor. 'd' destructor. 'c' destructor. destructor. <*>//e destructor. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1238" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1238: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1238" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reading a token Next token is token 'a' (<*>//e printer) Shifting token 'a' (<*>//e printer) Entering state 1 Stack now 0 1 Reading a token Next token is token 'b' ( printer) Shifting token 'b' ( printer) Entering state 3 Stack now 0 1 3 Reading a token Next token is token 'c' ('c' printer) Shifting token 'c' ('c' printer) Entering state 5 Stack now 0 1 3 5 Reading a token Next token is token 'd' ('d' printer) Shifting token 'd' ('d' printer) Entering state 6 Stack now 0 1 3 5 6 Reading a token Next token is token 'e' (<*>//e printer) Shifting token 'e' (<*>//e printer) Entering state 7 Stack now 0 1 3 5 6 7 Reading a token Next token is token 'f' (<*>//e printer) Shifting token 'f' (<*>//e printer) Entering state 8 Stack now 0 1 3 5 6 7 8 Reading a token Now at end of input. syntax error, unexpected end of file, expecting 'g' Error: popping token 'f' (<*>//e printer) Stack now 0 1 3 5 6 7 Error: popping token 'e' (<*>//e printer) Stack now 0 1 3 5 6 Error: popping token 'd' ('d' printer) Stack now 0 1 3 5 Error: popping token 'c' ('c' printer) Stack now 0 1 3 Error: popping token 'b' ( printer) Stack now 0 1 Error: popping token 'a' (<*>//e printer) Stack now 0 Cleanup: discarding lookahead token \"end of file\" () Stack now 0 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1238" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_346 #AT_START_347 at_fn_group_banner 347 'actions.at:1307' \ "Default %printer and %destructor for user-defined end token" "" 14 at_xfail=no ( printf "%s\n" "347. $at_setup_line: testing $at_desc ..." $at_traceon # Enable declaration of default %printer/%destructor. Make the parser # use these for all user-declared grammar symbols for which the user # does not declare a specific %printer/%destructor. Thus, the parser # uses it for token 0 if the user declares it but not if Bison # generates it as $end. Discussed starting at # , # , and # . # AT_TEST(TYPED) # -------------- cat >input0.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %locations %code { #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(SYM) } %destructor { #error "<*> destructor should not be used." } <*> %token END 0 %printer { fprintf (yyo, "<> for '%c' @ %d", $$, @$.first_column); } <> %destructor { printf ("<> for '%c' @ %d.\n", $$, @$.first_column); } <> %printer { #error "<*> printer should not be used." } <*> %% start: { $$ = 'S'; } ; %% #include /* abort */ static int yylex (void) { static int called; if (called++) abort (); yylval = 'E'; yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; return 0; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input0.c input0.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input0.c input0.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input0.c input0.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input0.c input0.y" "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input0.c input0.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1416: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1416" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1416: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1416" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1416: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1416" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input0.c input0.y" at_fn_check_prepare_trace "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input0.c input0.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input0.y:30.3-5: warning: useless %destructor for type <*> [-Wother] input0.y:30.3-5: warning: useless %printer for type <*> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y -Werror" "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input0.y:30.3-5: warning: useless %destructor for type <*> [-Wother] input0.y:30.3-5: warning: useless %printer for type <*> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1416: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1416" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y --warnings=error" "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y -Wnone,none -Werror --trace=none" "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y --warnings=none -Werror --trace=none" "actions.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input0.c input0.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1416" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1416" { set +x printf "%s\n" "$at_srcdir/actions.at:1416: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input0 input0.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input0 input0.c $LIBS" "actions.at:1416" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input0 input0.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1416: \$PREPARSER ./input0 --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input0 --debug" "actions.at:1416" ( $at_check_trace; $PREPARSER ./input0 --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "<> for 'E' @ 1. <> for 'S' @ 1. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reducing stack by rule 1 (line 49): -> \$\$ = nterm start (1.1: <> for 'S' @ 1) Entering state 1 Stack now 0 1 Reading a token Now at end of input. Shifting token END (1.1: <> for 'E' @ 1) Entering state 2 Stack now 0 1 2 Stack now 0 1 2 Cleanup: popping token END (1.1: <> for 'E' @ 1) Cleanup: popping nterm start (1.1: <> for 'S' @ 1) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input1.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %locations %code { #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(SYM) } %destructor { #error "<> destructor should not be used." } <> %token END 0 %printer { fprintf (yyo, "<*> for '%c' @ %d", $$, @$.first_column); } <*> %destructor { printf ("<*> for '%c' @ %d.\n", $$, @$.first_column); } <*> %printer { #error "<> printer should not be used." } <> %union { char tag; } %type start END %% start: { $$ = 'S'; } ; %% #include /* abort */ static int yylex (void) { static int called; if (called++) abort (); yylval.tag = 'E'; yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; return 0; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input1.c input1.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input1.c input1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input1.c input1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input1.c input1.y" "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input1.c input1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1417: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1417" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1417: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1417" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1417: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1417" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input1.c input1.y" at_fn_check_prepare_trace "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input1.c input1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input1.y:30.3-4: warning: useless %destructor for type <> [-Wother] input1.y:30.3-4: warning: useless %printer for type <> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y -Werror" "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input1.y:30.3-4: warning: useless %destructor for type <> [-Wother] input1.y:30.3-4: warning: useless %printer for type <> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1417: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1417" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y --warnings=error" "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y -Wnone,none -Werror --trace=none" "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y --warnings=none -Werror --trace=none" "actions.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input1.c input1.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1417" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1417" { set +x printf "%s\n" "$at_srcdir/actions.at:1417: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input1 input1.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input1 input1.c $LIBS" "actions.at:1417" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input1 input1.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1417: \$PREPARSER ./input1 --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input1 --debug" "actions.at:1417" ( $at_check_trace; $PREPARSER ./input1 --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "<*> for 'E' @ 1. <*> for 'S' @ 1. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1417: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1417" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reducing stack by rule 1 (line 49): -> \$\$ = nterm start (1.1: <*> for 'S' @ 1) Entering state 1 Stack now 0 1 Reading a token Now at end of input. Shifting token END (1.1: <*> for 'E' @ 1) Entering state 2 Stack now 0 1 2 Stack now 0 1 2 Cleanup: popping token END (1.1: <*> for 'E' @ 1) Cleanup: popping nterm start (1.1: <*> for 'S' @ 1) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1417" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_347 #AT_START_348 at_fn_group_banner 348 'actions.at:1429' \ "Default %printer and %destructor are not for error or \$undefined" "" 14 at_xfail=no ( printf "%s\n" "348. $at_setup_line: testing $at_desc ..." $at_traceon # If Bison were to apply the default %printer and %destructor to the error # token or to $undefined: # - For the error token: # - It would generate warnings for unused $n. # - It would invoke the %printer and %destructor on the error token's # semantic value, which would be initialized from the lookahead, which # would be destroyed separately. # - For $undefined, who knows what the semantic value would be. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %{ # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(SYM) %} %printer { fprintf (yyo, "'%c'", $$); } <> <*> %destructor { fprintf (stderr, "DESTROY '%c'\n", $$); } <> <*> %% start: { $$ = 'S'; } /* In order to reveal the problems that this bug caused during parsing, add * $2 to USE. */ | 'a' error 'b' 'c' { USE(($1, $3, $4)); $$ = 'S'; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "abd"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; yylval = res; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1474: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1474" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1474: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1474" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1474: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1474" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:23.6-8: warning: useless %destructor for type <*> [-Wother] input.y:23.6-8: warning: useless %printer for type <*> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:23.6-8: warning: useless %destructor for type <*> [-Wother] input.y:23.6-8: warning: useless %printer for type <*> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1474: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1474" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1474: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "actions.at:1474" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1474" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1478" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1478" { set +x printf "%s\n" "$at_srcdir/actions.at:1478: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1478" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1479: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1479" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reading a token Next token is token 'a' ('a') Shifting token 'a' ('a') Entering state 1 Stack now 0 1 Reading a token Next token is token 'b' ('b') syntax error Shifting token error () Entering state 3 Stack now 0 1 3 Next token is token 'b' ('b') Shifting token 'b' ('b') Entering state 5 Stack now 0 1 3 5 Reading a token Next token is token \"invalid token\" () Error: popping token 'b' ('b') DESTROY 'b' Stack now 0 1 3 Error: popping token error () Stack now 0 1 Shifting token error () Entering state 3 Stack now 0 1 3 Next token is token \"invalid token\" () Error: discarding token \"invalid token\" () Error: popping token error () Stack now 0 1 Shifting token error () Entering state 3 Stack now 0 1 3 Reading a token Now at end of input. Cleanup: discarding lookahead token \"end of file\" () Stack now 0 1 3 Cleanup: popping token error () Cleanup: popping token 'a' ('a') DESTROY 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1479" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_348 #AT_START_349 at_fn_group_banner 349 'actions.at:1532' \ "Default %printer and %destructor are not for \$accept" "" 14 at_xfail=no ( printf "%s\n" "349. $at_setup_line: testing $at_desc ..." $at_traceon # If YYSTYPE is a union and Bison were to apply the default %printer and # %destructor to $accept: # - The %printer and %destructor code generated for $accept would always be # dead code because $accept is currently never shifted onto the stack. # - $$ for $accept would always be of type YYSTYPE because it's not possible # to declare '%type $accept'. (Also true for $undefined.) # - Thus, the compiler might complain that the user code assumes the wrong # type for $$ since the code might assume the type associated with a # specific union field, which is especially reasonable in C++ since that # type may be a base type. This test case checks for this problem. (Also # true for $undefined and the error token, so there are three warnings for # %printer and three for %destructor.) cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug /* So that %printer is actually compiled. */ %{ # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(SYM) %} %printer { char chr = $$; fprintf (yyo, "'%c'", chr); } <> <*> %destructor { char chr = $$; fprintf (stderr, "DESTROY '%c'\n", chr); } <> <*> %union { char chr; } %type start %% start: { USE($$); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1582: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1582" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1582: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1582" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1582: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1582" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:24.3-4: warning: useless %destructor for type <> [-Wother] input.y:24.3-4: warning: useless %printer for type <> [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:24.3-4: warning: useless %destructor for type <> [-Wother] input.y:24.3-4: warning: useless %printer for type <> [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1582: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1582" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1582: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "actions.at:1582" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1582" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1586" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1586" { set +x printf "%s\n" "$at_srcdir/actions.at:1586: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1586" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1586" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_349 #AT_START_350 at_fn_group_banner 350 'actions.at:1596' \ "Default %printer and %destructor for midrule values" "" 14 at_xfail=no ( printf "%s\n" "350. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug /* So that %printer is actually compiled. */ %{ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define USE(SYM) # define YYLTYPE int # define YYLLOC_DEFAULT(Current, Rhs, N) (void)(Rhs) # define LOCATION_PRINT(File, Loc) %} %printer { fprintf (yyo, "%d", @$); } <> %destructor { fprintf (stderr, "DESTROY %d\n", @$); } <> %printer { #error "<*> printer should not be used" } <*> %destructor { #error "<*> destructor should not be used" } <*> %% start: { @$ = 1; } // Not set or used. { USE ($$); @$ = 2; } // Both set and used. { USE ($$); @$ = 3; } // Only set. { @$ = 4; } // Only used. 'c' { USE (($$, $2, $4, $5)); @$ = 0; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1634: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1634" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1634: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1634" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1634: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1634" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:24.57-59: warning: useless %destructor for type <*> [-Wother] input.y:24.57-59: warning: useless %printer for type <*> [-Wother] input.y:33.3-23: warning: unset value: \$\$ [-Wother] input.y:32.3-23: warning: unused value: \$3 [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror" "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:24.57-59: warning: useless %destructor for type <*> [-Wother] input.y:24.57-59: warning: useless %printer for type <*> [-Wother] input.y:33.3-23: warning: unset value: $$ [-Wother] input.y:32.3-23: warning: unused value: $3 [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1634: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1634" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error" "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none" "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1634: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none" "actions.at:1634" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1634" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1641: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1641" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1641: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1641" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1641: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1641" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:24.57-59: warning: useless %destructor for type <*> [-Wother] 24 | %printer { #error \"<*> printer should not be used\" } <*> | ^~~ input.y:24.57-59: warning: useless %printer for type <*> [-Wother] 24 | %printer { #error \"<*> printer should not be used\" } <*> | ^~~ input.y:33.3-23: warning: unset value: \$\$ [-Wother] 33 | { @\$ = 4; } // Only used. | ^~~~~~~~~~~~~~~~~~~~~ input.y:32.3-23: warning: unused value: \$3 [-Wother] 32 | { USE (\$\$); @\$ = 3; } // Only set. | ^~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:24.57-59: warning: useless %destructor for type <*> [-Wother] 24 | %printer { #error "<*> printer should not be used" } <*> | ^~~ input.y:24.57-59: warning: useless %printer for type <*> [-Wother] 24 | %printer { #error "<*> printer should not be used" } <*> | ^~~ input.y:33.3-23: warning: unset value: $$ [-Wother] 33 | { @$ = 4; } // Only used. | ^~~~~~~~~~~~~~~~~~~~~ input.y:32.3-23: warning: unused value: $3 [-Wother] 32 | { USE ($$); @$ = 3; } // Only set. | ^~~~~~~~~~~~~~~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/actions.at:1641: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "actions.at:1641" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1641: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" "actions.at:1641" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1641" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "actions.at:1656" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1656" { set +x printf "%s\n" "$at_srcdir/actions.at:1656: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1656" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1656" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1657: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1657" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/actions.at:1657" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1657: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1657" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reducing stack by rule 1 (line 30): -> \$\$ = nterm \$@1 (: ) Entering state 2 Stack now 0 2 Reducing stack by rule 2 (line 31): -> \$\$ = nterm @2 (: 2) Entering state 4 Stack now 0 2 4 Reducing stack by rule 3 (line 32): -> \$\$ = nterm @3 (: 3) Entering state 5 Stack now 0 2 4 5 Reducing stack by rule 4 (line 33): -> \$\$ = nterm @4 (: 4) Entering state 6 Stack now 0 2 4 5 6 Reading a token Now at end of input. syntax error Error: popping nterm @4 (: 4) DESTROY 4 Stack now 0 2 4 5 Error: popping nterm @3 (: 3) DESTROY 3 Stack now 0 2 4 Error: popping nterm @2 (: 2) DESTROY 2 Stack now 0 2 Error: popping nterm \$@1 (: ) Stack now 0 Cleanup: discarding lookahead token \"end of file\" (: ) Stack now 0 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1657" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_350 #AT_START_351 at_fn_group_banner 351 'actions.at:1743' \ "@\$ in %initial-action implies %locations" " " 14 at_xfail=no ( printf "%s\n" "351. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %debug %initial-action { fprintf (stderr, "%d\n", @$.first_line); } %% start: ; %% static int yylex (void) { return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1743: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1743" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1743: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1743" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1743: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1743" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1743: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1743" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1743: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1743" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1743: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1743" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1743" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1743" { set +x printf "%s\n" "$at_srcdir/actions.at:1743: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1743" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1743" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_351 #AT_START_352 at_fn_group_banner 352 'actions.at:1744' \ "@\$ in %destructor implies %locations" " " 14 at_xfail=no ( printf "%s\n" "352. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %debug %destructor { fprintf (stderr, "%d\n", @$.first_line); } start %% start: ; %% static int yylex (void) { return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1744: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1744" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1744: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1744" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1744: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1744" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1744: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1744" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1744: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1744" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1744: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1744" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1744" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1744" { set +x printf "%s\n" "$at_srcdir/actions.at:1744: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1744" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1744" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_352 #AT_START_353 at_fn_group_banner 353 'actions.at:1745' \ "@\$ in %printer implies %locations" " " 14 at_xfail=no ( printf "%s\n" "353. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %debug %printer { fprintf (stderr, "%d\n", @$.first_line); } start %% start: ; %% static int yylex (void) { return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1745: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1745" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1745: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1745" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1745: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1745" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1745: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1745" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1745: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1745" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1745: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1745" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1745" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1745" { set +x printf "%s\n" "$at_srcdir/actions.at:1745: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1745" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1745" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_353 #AT_START_354 at_fn_group_banner 354 'actions.at:1856' \ "Qualified \$\$ in actions: yacc.c" " " 14 at_xfail=no ( printf "%s\n" "354. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "yacc.c" %debug %code requires { typedef struct sem_type { int ival; float fval; } sem_type; # include static void report (FILE* yyo, int ival, float fval) { fprintf (yyo, "ival: %d, fval: %1.1f", ival, fval); } } %define api.value.type {sem_type} %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token UNTYPED %token INT %type float %printer { report (yyo, $$, $$); } ; %printer { report (yyo, $$, $$ ); } ; %printer { report (yyo, $$, $$); } <>; %initial-action { $$ = 42; $$ = 4.2f; } %% float: UNTYPED INT { $$ = $1 + $2; $$ = $1 + $2; }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {UNTYPED, INT, EOF}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (yylval).ival = toknum * 10; (yylval).fval = YY_CAST (float, toknum) / 10.0f;; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1856" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1856" { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1856" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1856" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # Don't be too picky on the traces, GLR is not exactly the same. Keep # only the lines from the printer. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -ne '/ival:/p' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -ne '/ival:/p' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Next token is token UNTYPED (ival: 10, fval: 0.1) Shifting token UNTYPED (ival: 10, fval: 0.1) Next token is token INT (ival: 20, fval: 0.2) Shifting token INT (ival: 20, fval: 0.2) \$1 = token UNTYPED (ival: 10, fval: 0.1) \$2 = token INT (ival: 20, fval: 0.2) -> \$\$ = nterm float (ival: 30, fval: 0.3) Cleanup: popping nterm float (ival: 30, fval: 0.3) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_354 #AT_START_355 at_fn_group_banner 355 'actions.at:1856' \ "Qualified \$\$ in actions: glr.c" " " 14 at_xfail=no ( printf "%s\n" "355. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.c" %debug %code requires { typedef struct sem_type { int ival; float fval; } sem_type; # include static void report (FILE* yyo, int ival, float fval) { fprintf (yyo, "ival: %d, fval: %1.1f", ival, fval); } } %define api.value.type {sem_type} %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token UNTYPED %token INT %type float %printer { report (yyo, $$, $$); } ; %printer { report (yyo, $$, $$ ); } ; %printer { report (yyo, $$, $$); } <>; %initial-action { $$ = 42; $$ = 4.2f; } %% float: UNTYPED INT { $$ = $1 + $2; $$ = $1 + $2; }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = {UNTYPED, INT, EOF}; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (yylval).ival = toknum * 10; (yylval).fval = YY_CAST (float, toknum) / 10.0f;; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1856" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1856" { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1856" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1856" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # Don't be too picky on the traces, GLR is not exactly the same. Keep # only the lines from the printer. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -ne '/ival:/p' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -ne '/ival:/p' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Next token is token UNTYPED (ival: 10, fval: 0.1) Shifting token UNTYPED (ival: 10, fval: 0.1) Next token is token INT (ival: 20, fval: 0.2) Shifting token INT (ival: 20, fval: 0.2) \$1 = token UNTYPED (ival: 10, fval: 0.1) \$2 = token INT (ival: 20, fval: 0.2) -> \$\$ = nterm float (ival: 30, fval: 0.3) Cleanup: popping nterm float (ival: 30, fval: 0.3) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_355 #AT_START_356 at_fn_group_banner 356 'actions.at:1856' \ "Qualified \$\$ in actions: lalr1.cc" " " 14 at_xfail=no ( printf "%s\n" "356. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %debug %code requires { typedef struct sem_type { int ival; float fval; } sem_type; # include // EOF. # include namespace { void report (std::ostream& yyo, int ival, float fval) { yyo << "ival: " << ival << ", fval: " << fval; } } } %define api.value.type {sem_type} %code { static int yylex (yy::parser::value_type *lvalp); } %token UNTYPED %token INT %type float %printer { report (yyo, $$, $$); } ; %printer { report (yyo, $$, $$ ); } ; %printer { report (yyo, $$, $$); } <>; %initial-action { $$ = 42; $$ = 4.2f; } %% float: UNTYPED INT { $$ = $1 + $2; $$ = $1 + $2; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = {yy::parser::token::UNTYPED, yy::parser::token::INT, EOF}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (*lvalp).ival = toknum * 10; (*lvalp).fval = YY_CAST (float, toknum) / 10.0f;; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1856" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1856" { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1856" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1856" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # Don't be too picky on the traces, GLR is not exactly the same. Keep # only the lines from the printer. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -ne '/ival:/p' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -ne '/ival:/p' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Next token is token UNTYPED (ival: 10, fval: 0.1) Shifting token UNTYPED (ival: 10, fval: 0.1) Next token is token INT (ival: 20, fval: 0.2) Shifting token INT (ival: 20, fval: 0.2) \$1 = token UNTYPED (ival: 10, fval: 0.1) \$2 = token INT (ival: 20, fval: 0.2) -> \$\$ = nterm float (ival: 30, fval: 0.3) Cleanup: popping nterm float (ival: 30, fval: 0.3) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_356 #AT_START_357 at_fn_group_banner 357 'actions.at:1856' \ "Qualified \$\$ in actions: glr.cc" " " 14 at_xfail=no ( printf "%s\n" "357. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %debug %code requires { typedef struct sem_type { int ival; float fval; } sem_type; # include // EOF. # include namespace { void report (std::ostream& yyo, int ival, float fval) { yyo << "ival: " << ival << ", fval: " << fval; } } } %define api.value.type {sem_type} %code { static int yylex (yy::parser::value_type *lvalp); } %token UNTYPED %token INT %type float %printer { report (yyo, $$, $$); } ; %printer { report (yyo, $$, $$ ); } ; %printer { report (yyo, $$, $$); } <>; %initial-action { $$ = 42; $$ = 4.2f; } %% float: UNTYPED INT { $$ = $1 + $2; $$ = $1 + $2; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = {yy::parser::token::UNTYPED, yy::parser::token::INT, EOF}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (*lvalp).ival = toknum * 10; (*lvalp).fval = YY_CAST (float, toknum) / 10.0f;; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1856" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1856" { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1856" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1856" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # Don't be too picky on the traces, GLR is not exactly the same. Keep # only the lines from the printer. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -ne '/ival:/p' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -ne '/ival:/p' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Next token is token UNTYPED (ival: 10, fval: 0.1) Shifting token UNTYPED (ival: 10, fval: 0.1) Next token is token INT (ival: 20, fval: 0.2) Shifting token INT (ival: 20, fval: 0.2) \$1 = token UNTYPED (ival: 10, fval: 0.1) \$2 = token INT (ival: 20, fval: 0.2) -> \$\$ = nterm float (ival: 30, fval: 0.3) Cleanup: popping nterm float (ival: 30, fval: 0.3) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_357 #AT_START_358 at_fn_group_banner 358 'actions.at:1856' \ "Qualified \$\$ in actions: glr2.cc" " " 14 at_xfail=no ( printf "%s\n" "358. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr2.cc" %debug %code requires { typedef struct sem_type { int ival; float fval; } sem_type; # include // EOF. # include namespace { void report (std::ostream& yyo, int ival, float fval) { yyo << "ival: " << ival << ", fval: " << fval; } } } %define api.value.type {sem_type} %code { static int yylex (yy::parser::value_type *lvalp); } %token UNTYPED %token INT %type float %printer { report (yyo, $$, $$); } ; %printer { report (yyo, $$, $$ ); } ; %printer { report (yyo, $$, $$); } <>; %initial-action { $$ = 42; $$ = 4.2f; } %% float: UNTYPED INT { $$ = $1 + $2; $$ = $1 + $2; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = {yy::parser::token::UNTYPED, yy::parser::token::INT, EOF}; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (*lvalp).ival = toknum * 10; (*lvalp).fval = YY_CAST (float, toknum) / 10.0f;; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1856" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1856" printf "%s\n" "actions.at:1856" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1856" { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "actions.at:1856" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "actions.at:1856" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } # Don't be too picky on the traces, GLR is not exactly the same. Keep # only the lines from the printer. { set +x printf "%s\n" "$at_srcdir/actions.at:1856: sed -ne '/ival:/p' stderr" at_fn_check_prepare_trace "actions.at:1856" ( $at_check_trace; sed -ne '/ival:/p' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Next token is token UNTYPED (ival: 10, fval: 0.1) Shifting token UNTYPED (ival: 10, fval: 0.1) Next token is token INT (ival: 20, fval: 0.2) Shifting token INT (ival: 20, fval: 0.2) \$1 = token UNTYPED (ival: 10, fval: 0.1) \$2 = token INT (ival: 20, fval: 0.2) -> \$\$ = nterm float (ival: 30, fval: 0.3) Cleanup: popping nterm float (ival: 30, fval: 0.3) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1856" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_358 #AT_START_359 at_fn_group_banner 359 'actions.at:1863' \ "Destroying lookahead assigned by semantic action" "" 14 at_xfail=no ( printf "%s\n" "359. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define USE(Var) } %destructor { fprintf (stderr, "'a' destructor\n"); } 'a' %destructor { fprintf (stderr, "'b' destructor\n"); } 'b' %% // In a previous version of Bison, yychar assigned by the semantic // action below was not translated into yytoken before the lookahead was // discarded and thus before its destructor (selected according to // yytoken) was called in order to return from yyparse. This would // happen even if YYACCEPT was performed in a later semantic action as // long as only consistent states with default reductions were visited // in between. However, we leave YYACCEPT in the same semantic action // for this test in order to show that skeletons cannot simply translate // immediately after every semantic action because a semantic action // that has set yychar might not always return normally. Instead, // skeletons must translate before every use of yytoken. start: 'a' accept { USE($1); } ; accept: %empty { assert (yychar == YYEMPTY); yychar = 'b'; YYACCEPT; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1905: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1905" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1905" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1905: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1905" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1905" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1905: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1905" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1905" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1905: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1905" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1905" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1905: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1905" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1905" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1905: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1905" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1905" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1906" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1906" { set +x printf "%s\n" "$at_srcdir/actions.at:1906: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1906" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1906" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1907: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:1907" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1907" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1907: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1907" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "'b' destructor 'a' destructor " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1907" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_359 #AT_START_360 at_fn_group_banner 360 'actions.at:1918' \ "YYBACKUP" " " 14 at_xfail=no ( printf "%s\n" "360. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.error verbose %debug %define api.pure %code { # include # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %% input: exp exp {} ; exp: 'a' { printf ("a: %d\n", $1); } | 'b' { YYBACKUP('a', 123); } | 'c' 'd' { YYBACKUP('a', 456); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "bcd"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; *lvalp = (toknum + 1) * 10; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/actions.at:1953: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "actions.at:1953" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1953" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1953: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "actions.at:1953" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1953" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/actions.at:1953: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1953" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1953" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/actions.at:1953: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "actions.at:1953" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1953" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/actions.at:1953: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "actions.at:1953" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1953" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/actions.at:1953: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "actions.at:1953" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1953" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "actions.at:1954" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/actions.at:1954" { set +x printf "%s\n" "$at_srcdir/actions.at:1954: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "actions.at:1954" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1954" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1955: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "actions.at:1955" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "a: 123 a: 456 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1955" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/actions.at:1955: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "actions.at:1955" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/actions.at:1955" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_360 #AT_START_361 at_fn_group_banner 361 'types.at:25' \ "%union vs. api.value.type" " " 15 at_xfail=no ( printf "%s\n" "361. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %union { int ival; } %define api.value.type union-directive %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/types.at:34: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "types.at:34" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-38: error: '%union' and '%define api.value.type' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/types.at:34" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_361 #AT_START_362 at_fn_group_banner 362 'types.at:44' \ "%yacc vs. api.value.type=union" " " 15 at_xfail=no ( printf "%s\n" "362. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %yacc %define api.value.type union %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/types.at:53: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "types.at:53" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-28: error: '%yacc' and '%define api.value.type \"union\"' cannot be used together " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/types.at:53" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_362 #AT_START_363 at_fn_group_banner 363 'types.at:139' \ "yacc.c api.value.type={double}" " " 15 at_xfail=no ( printf "%s\n" "363. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {double} %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_363 #AT_START_364 at_fn_group_banner 364 'types.at:139' \ "yacc.c api.value.type={double} %header" " " 15 at_xfail=no ( printf "%s\n" "364. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {double} %header %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_364 #AT_START_365 at_fn_group_banner 365 'types.at:139' \ "yacc.c api.value.type={variant}" " " 15 at_xfail=no ( printf "%s\n" "365. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {variant} %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_365 #AT_START_366 at_fn_group_banner 366 'types.at:139' \ "yacc.c api.value.type={variant} %header" " " 15 at_xfail=no ( printf "%s\n" "366. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {variant} %header %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_366 #AT_START_367 at_fn_group_banner 367 'types.at:139' \ "yacc.c api.value.type={struct foo}" " " 15 at_xfail=no ( printf "%s\n" "367. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {struct foo} %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).ival = (res - '0') * 10; (yylval).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_367 #AT_START_368 at_fn_group_banner 368 'types.at:139' \ "yacc.c api.value.type={struct foo} %header" " " 15 at_xfail=no ( printf "%s\n" "368. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {struct foo} %header %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).ival = (res - '0') * 10; (yylval).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_368 #AT_START_369 at_fn_group_banner 369 'types.at:139' \ "yacc.c api.value.type={struct bar}" " " 15 at_xfail=no ( printf "%s\n" "369. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {struct bar} %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { fprintf (yyo, "%d", $$); } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).up = YY_CAST (struct u *, malloc (sizeof *(yylval).up)); assert ((yylval).up); (yylval).up->ival = res - '0'; } ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_369 #AT_START_370 at_fn_group_banner 370 'types.at:139' \ "yacc.c api.value.type={struct bar} %header" " " 15 at_xfail=no ( printf "%s\n" "370. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {struct bar} %header %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { fprintf (yyo, "%d", $$); } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).up = YY_CAST (struct u *, malloc (sizeof *(yylval).up)); assert ((yylval).up); (yylval).up->ival = res - '0'; } ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_370 #AT_START_371 at_fn_group_banner 371 'types.at:139' \ "yacc.c api.value.type={union foo}" " " 15 at_xfail=no ( printf "%s\n" "371. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {union foo} %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = .2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_371 #AT_START_372 at_fn_group_banner 372 'types.at:139' \ "yacc.c api.value.type={union foo} %header" " " 15 at_xfail=no ( printf "%s\n" "372. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type {union foo} %header %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = .2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_372 #AT_START_373 at_fn_group_banner 373 'types.at:139' \ "yacc.c %union { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "373. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_373 #AT_START_374 at_fn_group_banner 374 'types.at:139' \ "yacc.c %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "374. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_374 #AT_START_375 at_fn_group_banner 375 'types.at:139' \ "yacc.c %union foo { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "375. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %union foo { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_375 #AT_START_376 at_fn_group_banner 376 'types.at:139' \ "yacc.c %union foo { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "376. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %union foo { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_376 #AT_START_377 at_fn_group_banner 377 'types.at:139' \ "yacc.c api.value.union.name=foo; %union { float fval; int ival; };" "" 15 at_xfail=no ( printf "%s\n" "377. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.union.name foo; %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_377 #AT_START_378 at_fn_group_banner 378 'types.at:139' \ "yacc.c api.value.union.name=foo; %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "378. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.union.name foo; %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_378 #AT_START_379 at_fn_group_banner 379 'types.at:139' \ "yacc.c api.value.type=union" " " 15 at_xfail=no ( printf "%s\n" "379. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type union %token ONE 101; %token TWO 102 THREE 103; %printer { fprintf (yyo, "%d", $$); } %printer { fprintf (yyo, "%f", $$); } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (yylval).ONE = 10; else if (res == 102) (yylval).TWO = .2f; else if (res == 103) (yylval).THREE = 3.3f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_379 #AT_START_380 at_fn_group_banner 380 'types.at:139' \ "yacc.c api.value.type=union %header" " " 15 at_xfail=no ( printf "%s\n" "380. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "yacc.c" %define api.value.type union %header %token ONE 101; %token TWO 102 THREE 103; %printer { fprintf (yyo, "%d", $$); } %printer { fprintf (yyo, "%f", $$); } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (yylval).ONE = 10; else if (res == 102) (yylval).TWO = .2f; else if (res == 103) (yylval).THREE = 3.3f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_380 #AT_START_381 at_fn_group_banner 381 'types.at:139' \ "glr.c api.value.type={double}" " " 15 at_xfail=no ( printf "%s\n" "381. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {double} %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_381 #AT_START_382 at_fn_group_banner 382 'types.at:139' \ "glr.c api.value.type={double} %header" " " 15 at_xfail=no ( printf "%s\n" "382. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {double} %header %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_382 #AT_START_383 at_fn_group_banner 383 'types.at:139' \ "glr.c api.value.type={variant}" " " 15 at_xfail=no ( printf "%s\n" "383. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {variant} %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_383 #AT_START_384 at_fn_group_banner 384 'types.at:139' \ "glr.c api.value.type={variant} %header" " " 15 at_xfail=no ( printf "%s\n" "384. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {variant} %header %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (yylval) = (res - '0') / 10.0; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_384 #AT_START_385 at_fn_group_banner 385 'types.at:139' \ "glr.c api.value.type={struct foo}" " " 15 at_xfail=no ( printf "%s\n" "385. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {struct foo} %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).ival = (res - '0') * 10; (yylval).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_385 #AT_START_386 at_fn_group_banner 386 'types.at:139' \ "glr.c api.value.type={struct foo} %header" " " 15 at_xfail=no ( printf "%s\n" "386. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {struct foo} %header %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).ival = (res - '0') * 10; (yylval).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_386 #AT_START_387 at_fn_group_banner 387 'types.at:139' \ "glr.c api.value.type={struct bar}" " " 15 at_xfail=no ( printf "%s\n" "387. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {struct bar} %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { fprintf (yyo, "%d", $$); } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).up = YY_CAST (struct u *, malloc (sizeof *(yylval).up)); assert ((yylval).up); (yylval).up->ival = res - '0'; } ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_387 #AT_START_388 at_fn_group_banner 388 'types.at:139' \ "glr.c api.value.type={struct bar} %header" " " 15 at_xfail=no ( printf "%s\n" "388. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {struct bar} %header %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { fprintf (yyo, "%d", $$); } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (yylval).up = YY_CAST (struct u *, malloc (sizeof *(yylval).up)); assert ((yylval).up); (yylval).up->ival = res - '0'; } ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_388 #AT_START_389 at_fn_group_banner 389 'types.at:139' \ "glr.c api.value.type={union foo}" " " 15 at_xfail=no ( printf "%s\n" "389. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {union foo} %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = .2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_389 #AT_START_390 at_fn_group_banner 390 'types.at:139' \ "glr.c api.value.type={union foo} %header" " " 15 at_xfail=no ( printf "%s\n" "390. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type {union foo} %header %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = .2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_390 #AT_START_391 at_fn_group_banner 391 'types.at:139' \ "glr.c %union { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "391. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_391 #AT_START_392 at_fn_group_banner 392 'types.at:139' \ "glr.c %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "392. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_392 #AT_START_393 at_fn_group_banner 393 'types.at:139' \ "glr.c %union foo { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "393. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %union foo { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_393 #AT_START_394 at_fn_group_banner 394 'types.at:139' \ "glr.c %union foo { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "394. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %union foo { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_394 #AT_START_395 at_fn_group_banner 395 'types.at:139' \ "glr.c api.value.union.name=foo; %union { float fval; int ival; };" "" 15 at_xfail=no ( printf "%s\n" "395. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.union.name foo; %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_395 #AT_START_396 at_fn_group_banner 396 'types.at:139' \ "glr.c api.value.union.name=foo; %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "396. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.union.name foo; %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (yylval).ival = 10; else if (res == '2') (yylval).fval = 0.2f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_396 #AT_START_397 at_fn_group_banner 397 'types.at:139' \ "glr.c api.value.type=union" " " 15 at_xfail=no ( printf "%s\n" "397. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type union %token ONE 101; %token TWO 102 THREE 103; %printer { fprintf (yyo, "%d", $$); } %printer { fprintf (yyo, "%f", $$); } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (yylval).ONE = 10; else if (res == 102) (yylval).TWO = .2f; else if (res == 103) (yylval).THREE = 3.3f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_397 #AT_START_398 at_fn_group_banner 398 'types.at:139' \ "glr.c api.value.type=union %header" " " 15 at_xfail=no ( printf "%s\n" "398. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %skeleton "glr.c" %define api.value.type union %header %token ONE 101; %token TWO 102 THREE 103; %printer { fprintf (yyo, "%d", $$); } %printer { fprintf (yyo, "%f", $$); } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (yylval).ONE = 10; else if (res == 102) (yylval).TWO = .2f; else if (res == 103) (yylval).THREE = 3.3f; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.c test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.c test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o test test.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS" "types.at:139" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o test test.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_398 #AT_START_399 at_fn_group_banner 399 'types.at:139' \ "lalr1.cc api.value.type={double}" " " 15 at_xfail=no ( printf "%s\n" "399. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {double} %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_399 #AT_START_400 at_fn_group_banner 400 'types.at:139' \ "lalr1.cc api.value.type={double} %header" " " 15 at_xfail=no ( printf "%s\n" "400. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {double} %header %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_400 #AT_START_401 at_fn_group_banner 401 'types.at:139' \ "lalr1.cc api.value.type={variant}" " " 15 at_xfail=no ( printf "%s\n" "401. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {variant} %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_401 #AT_START_402 at_fn_group_banner 402 'types.at:139' \ "lalr1.cc api.value.type={variant} %header" " " 15 at_xfail=no ( printf "%s\n" "402. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {variant} %header %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_402 #AT_START_403 at_fn_group_banner 403 'types.at:139' \ "lalr1.cc api.value.type={struct foo}" " " 15 at_xfail=no ( printf "%s\n" "403. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {struct foo} %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).ival = (res - '0') * 10; (*lvalp).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_403 #AT_START_404 at_fn_group_banner 404 'types.at:139' \ "lalr1.cc api.value.type={struct foo} %header" " " 15 at_xfail=no ( printf "%s\n" "404. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {struct foo} %header %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).ival = (res - '0') * 10; (*lvalp).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_404 #AT_START_405 at_fn_group_banner 405 'types.at:139' \ "lalr1.cc api.value.type={struct bar}" " " 15 at_xfail=no ( printf "%s\n" "405. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {struct bar} %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { yyo << $$; } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).up = YY_CAST (struct u *, malloc (sizeof *(*lvalp).up)); assert ((*lvalp).up); (*lvalp).up->ival = res - '0'; } ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_405 #AT_START_406 at_fn_group_banner 406 'types.at:139' \ "lalr1.cc api.value.type={struct bar} %header" " " 15 at_xfail=no ( printf "%s\n" "406. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {struct bar} %header %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { yyo << $$; } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).up = YY_CAST (struct u *, malloc (sizeof *(*lvalp).up)); assert ((*lvalp).up); (*lvalp).up->ival = res - '0'; } ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_406 #AT_START_407 at_fn_group_banner 407 'types.at:139' \ "lalr1.cc api.value.type={union foo}" " " 15 at_xfail=no ( printf "%s\n" "407. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {union foo} %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = .2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_407 #AT_START_408 at_fn_group_banner 408 'types.at:139' \ "lalr1.cc api.value.type={union foo} %header" " " 15 at_xfail=no ( printf "%s\n" "408. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type {union foo} %header %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = .2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_408 #AT_START_409 at_fn_group_banner 409 'types.at:139' \ "lalr1.cc %union { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "409. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = 0.2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_409 #AT_START_410 at_fn_group_banner 410 'types.at:139' \ "lalr1.cc %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "410. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = 0.2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_410 #AT_START_411 at_fn_group_banner 411 'types.at:139' \ "lalr1.cc api.value.type=union" " " 15 at_xfail=no ( printf "%s\n" "411. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type union %token ONE 101; %token TWO 102 THREE 103; %printer { yyo << $$; } %printer { yyo << $$; } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (*lvalp).ONE = 10; else if (res == 102) (*lvalp).TWO = .2f; else if (res == 103) (*lvalp).THREE = 3.3f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_411 #AT_START_412 at_fn_group_banner 412 'types.at:139' \ "lalr1.cc api.value.type=union %header" " " 15 at_xfail=no ( printf "%s\n" "412. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type union %header %token ONE 101; %token TWO 102 THREE 103; %printer { yyo << $$; } %printer { yyo << $$; } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (*lvalp).ONE = 10; else if (res == 102) (*lvalp).TWO = .2f; else if (res == 103) (*lvalp).THREE = 3.3f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_412 #AT_START_413 at_fn_group_banner 413 'types.at:139' \ "lalr1.cc api.value.type=variant" " " 15 at_xfail=no ( printf "%s\n" "413. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type variant %token '1'; %token '2'; %% start: '1' '2' { std::cout << $1 << ", " << $2 << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).build (10); else if (res == '2') (*lvalp).build ("two");; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, two " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_413 #AT_START_414 at_fn_group_banner 414 'types.at:139' \ "lalr1.cc api.value.type=variant %header" " " 15 at_xfail=no ( printf "%s\n" "414. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type variant %header %token '1'; %token '2'; %% start: '1' '2' { std::cout << $1 << ", " << $2 << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).build (10); else if (res == '2') (*lvalp).build ("two");; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, two " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_414 #AT_START_415 at_fn_group_banner 415 'types.at:139' \ "lalr1.cc api.value.type=variant" " " 15 at_xfail=no ( printf "%s\n" "415. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type variant %token > '1'; %token > '2'; %% start: '1' '2' { std::cout << $1.first << ':' << $1.second << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).build (std::make_pair (10, 11)); else if (res == '2') (*lvalp).build (std::pair ("two", "deux"));; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10:11, two:deux " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_415 #AT_START_416 at_fn_group_banner 416 'types.at:139' \ "lalr1.cc api.value.type=variant %header" " " 15 at_xfail=no ( printf "%s\n" "416. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %define api.value.type variant %header %token > '1'; %token > '2'; %% start: '1' '2' { std::cout << $1.first << ':' << $1.second << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).build (std::make_pair (10, 11)); else if (res == '2') (*lvalp).build (std::pair ("two", "deux"));; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10:11, two:deux " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_416 #AT_START_417 at_fn_group_banner 417 'types.at:139' \ "lalr1.cc api.value.type=variant api.token.constructor" "" 15 at_xfail=no ( printf "%s\n" "417. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %define api.value.type variant %define api.token.constructor %token > '1' '2'; %% start: '1' '2' { std::cout << $1.first << ':' << $1.second << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; typedef yy::parser::symbol_type symbol; if (res) return symbol (res, std::make_pair (res - '0', res - '0' + 1)); else return symbol (res); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1:2, 2:3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_417 #AT_START_418 at_fn_group_banner 418 'types.at:139' \ "lalr1.cc api.value.type=variant api.token.constructor %header" "" 15 at_xfail=no ( printf "%s\n" "418. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %define api.value.type variant %define api.token.constructor %header %token > '1' '2'; %% start: '1' '2' { std::cout << $1.first << ':' << $1.second << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; typedef yy::parser::symbol_type symbol; if (res) return symbol (res, std::make_pair (res - '0', res - '0' + 1)); else return symbol (res); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1:2, 2:3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_418 #AT_START_419 at_fn_group_banner 419 'types.at:139' \ "lalr1.cc %code requires { #include } api.value.type=variant" "" 15 at_xfail=no ( printf "%s\n" "419. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %code requires { #include } %define api.value.type variant %token > '1'; %token > '2'; %% start: '1' '2' { std::cout << *$1 << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).emplace > (std::make_unique (10)); else if (res == '2') (*lvalp).emplace > (21, 22);; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 21:22 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_419 #AT_START_420 at_fn_group_banner 420 'types.at:139' \ "lalr1.cc %code requires { #include } api.value.type=variant %header" "" 15 at_xfail=no ( printf "%s\n" "420. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %code requires { #include } %define api.value.type variant %header %token > '1'; %token > '2'; %% start: '1' '2' { std::cout << *$1 << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).emplace > (std::make_unique (10)); else if (res == '2') (*lvalp).emplace > (21, 22);; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 21:22 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_420 #AT_START_421 at_fn_group_banner 421 'types.at:139' \ "lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor" "" 15 at_xfail=no ( printf "%s\n" "421. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %code requires { #include } %define api.value.type variant %define api.token.constructor %token > ONE; %token > TWO; %token EOI 0; %% start: ONE TWO { std::cout << *$1 << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') return yy::parser::make_ONE (std::make_unique (10)); else if (res == '2') return yy::parser::make_TWO (std::make_pair (21, 22)); else return yy::parser::make_EOI (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 21:22 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_421 #AT_START_422 at_fn_group_banner 422 'types.at:139' \ "lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor %header" "" 15 at_xfail=no ( printf "%s\n" "422. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %code requires { #include } %define api.value.type variant %define api.token.constructor %header %token > ONE; %token > TWO; %token EOI 0; %% start: ONE TWO { std::cout << *$1 << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') return yy::parser::make_ONE (std::make_unique (10)); else if (res == '2') return yy::parser::make_TWO (std::make_pair (21, 22)); else return yy::parser::make_EOI (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 21:22 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_422 #AT_START_423 at_fn_group_banner 423 'types.at:139' \ "lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor" "" 15 at_xfail=no ( printf "%s\n" "423. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %code requires { #include } %define api.value.type variant %define api.token.constructor %token > '1'; %token > '2'; %% start: '1' '2' { std::cout << *$1 << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') return {res, std::make_unique (10)}; else if (res == '2') return {res, std::make_pair (21, 22)}; else return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 21:22 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_423 #AT_START_424 at_fn_group_banner 424 'types.at:139' \ "lalr1.cc %code requires { #include } api.value.type=variant api.token.constructor %header" "" 15 at_xfail=no ( printf "%s\n" "424. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %code requires { #include } %define api.value.type variant %define api.token.constructor %header %token > '1'; %token > '2'; %% start: '1' '2' { std::cout << *$1 << ", " << $2.first << ':' << $2.second << '\n'; }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') return {res, std::make_unique (10)}; else if (res == '2') return {res, std::make_pair (21, 22)}; else return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 21:22 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_424 #AT_START_425 at_fn_group_banner 425 'types.at:139' \ "glr.cc api.value.type={double}" " " 15 at_xfail=no ( printf "%s\n" "425. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {double} %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_425 #AT_START_426 at_fn_group_banner 426 'types.at:139' \ "glr.cc api.value.type={double} %header" " " 15 at_xfail=no ( printf "%s\n" "426. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {double} %header %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_426 #AT_START_427 at_fn_group_banner 427 'types.at:139' \ "glr.cc api.value.type={variant}" " " 15 at_xfail=no ( printf "%s\n" "427. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {variant} %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_427 #AT_START_428 at_fn_group_banner 428 'types.at:139' \ "glr.cc api.value.type={variant} %header" " " 15 at_xfail=no ( printf "%s\n" "428. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {variant} %header %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_428 #AT_START_429 at_fn_group_banner 429 'types.at:139' \ "glr.cc api.value.type={struct foo}" " " 15 at_xfail=no ( printf "%s\n" "429. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {struct foo} %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).ival = (res - '0') * 10; (*lvalp).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_429 #AT_START_430 at_fn_group_banner 430 'types.at:139' \ "glr.cc api.value.type={struct foo} %header" " " 15 at_xfail=no ( printf "%s\n" "430. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {struct foo} %header %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).ival = (res - '0') * 10; (*lvalp).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_430 #AT_START_431 at_fn_group_banner 431 'types.at:139' \ "glr.cc api.value.type={struct bar}" " " 15 at_xfail=no ( printf "%s\n" "431. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {struct bar} %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { yyo << $$; } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).up = YY_CAST (struct u *, malloc (sizeof *(*lvalp).up)); assert ((*lvalp).up); (*lvalp).up->ival = res - '0'; } ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_431 #AT_START_432 at_fn_group_banner 432 'types.at:139' \ "glr.cc api.value.type={struct bar} %header" " " 15 at_xfail=no ( printf "%s\n" "432. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {struct bar} %header %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { yyo << $$; } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).up = YY_CAST (struct u *, malloc (sizeof *(*lvalp).up)); assert ((*lvalp).up); (*lvalp).up->ival = res - '0'; } ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_432 #AT_START_433 at_fn_group_banner 433 'types.at:139' \ "glr.cc api.value.type={union foo}" " " 15 at_xfail=no ( printf "%s\n" "433. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {union foo} %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = .2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_433 #AT_START_434 at_fn_group_banner 434 'types.at:139' \ "glr.cc api.value.type={union foo} %header" " " 15 at_xfail=no ( printf "%s\n" "434. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type {union foo} %header %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = .2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_434 #AT_START_435 at_fn_group_banner 435 'types.at:139' \ "glr.cc %union { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "435. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = 0.2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_435 #AT_START_436 at_fn_group_banner 436 'types.at:139' \ "glr.cc %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "436. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = 0.2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_436 #AT_START_437 at_fn_group_banner 437 'types.at:139' \ "glr.cc api.value.type=union" " " 15 at_xfail=no ( printf "%s\n" "437. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type union %token ONE 101; %token TWO 102 THREE 103; %printer { yyo << $$; } %printer { yyo << $$; } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (*lvalp).ONE = 10; else if (res == 102) (*lvalp).TWO = .2f; else if (res == 103) (*lvalp).THREE = 3.3f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_437 #AT_START_438 at_fn_group_banner 438 'types.at:139' \ "glr.cc api.value.type=union %header" " " 15 at_xfail=no ( printf "%s\n" "438. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr.cc" %define api.value.type union %header %token ONE 101; %token TWO 102 THREE 103; %printer { yyo << $$; } %printer { yyo << $$; } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (*lvalp).ONE = 10; else if (res == 102) (*lvalp).TWO = .2f; else if (res == 103) (*lvalp).THREE = 3.3f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_438 #AT_START_439 at_fn_group_banner 439 'types.at:139' \ "glr2.cc api.value.type={double}" " " 15 at_xfail=no ( printf "%s\n" "439. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {double} %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_439 #AT_START_440 at_fn_group_banner 440 'types.at:139' \ "glr2.cc api.value.type={double} %header" " " 15 at_xfail=no ( printf "%s\n" "440. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {double} %header %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_440 #AT_START_441 at_fn_group_banner 441 'types.at:139' \ "glr2.cc api.value.type={variant}" " " 15 at_xfail=no ( printf "%s\n" "441. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {variant} %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_441 #AT_START_442 at_fn_group_banner 442 'types.at:139' \ "glr2.cc api.value.type={variant} %header" " " 15 at_xfail=no ( printf "%s\n" "442. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {variant} %header %code requires { typedef double variant; } %% start: '1' '2' { printf ("%2.1f\n", $1 + $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) (*lvalp) = (res - '0') / 10.0; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_442 #AT_START_443 at_fn_group_banner 443 'types.at:139' \ "glr2.cc api.value.type={struct foo}" " " 15 at_xfail=no ( printf "%s\n" "443. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {struct foo} %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).ival = (res - '0') * 10; (*lvalp).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_443 #AT_START_444 at_fn_group_banner 444 'types.at:139' \ "glr2.cc api.value.type={struct foo} %header" " " 15 at_xfail=no ( printf "%s\n" "444. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {struct foo} %header %code requires { struct foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival + $2.ival, $1.fval + $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).ival = (res - '0') * 10; (*lvalp).fval = YY_CAST (float, res - '0') / 10.f; }; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "30 0.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_444 #AT_START_445 at_fn_group_banner 445 'types.at:139' \ "glr2.cc api.value.type={struct bar}" " " 15 at_xfail=no ( printf "%s\n" "445. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {struct bar} %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { yyo << $$; } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).up = YY_CAST (struct u *, malloc (sizeof *(*lvalp).up)); assert ((*lvalp).up); (*lvalp).up->ival = res - '0'; } ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_445 #AT_START_446 at_fn_group_banner 446 'types.at:139' \ "glr2.cc api.value.type={struct bar} %header" " " 15 at_xfail=no ( printf "%s\n" "446. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {struct bar} %header %code requires { struct u { int ival; }; struct bar { struct u *up; }; } %token ival> '1' '2' %printer { yyo << $$; } ival> %% start: '1' '2' { printf ("%d %d\n", $1, $ival>2); free ($1); free ($2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res) { (*lvalp).up = YY_CAST (struct u *, malloc (sizeof *(*lvalp).up)); assert ((*lvalp).up); (*lvalp).up->ival = res - '0'; } ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "1 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_446 #AT_START_447 at_fn_group_banner 447 'types.at:139' \ "glr2.cc api.value.type={union foo}" " " 15 at_xfail=no ( printf "%s\n" "447. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {union foo} %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = .2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_447 #AT_START_448 at_fn_group_banner 448 'types.at:139' \ "glr2.cc api.value.type={union foo} %header" " " 15 at_xfail=no ( printf "%s\n" "448. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type {union foo} %header %code requires { union foo { float fval; int ival; }; } %% start: '1' '2' { printf ("%d %2.1f\n", $1.ival, $2.fval); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = .2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_448 #AT_START_449 at_fn_group_banner 449 'types.at:139' \ "glr2.cc %union { float fval; int ival; };" " " 15 at_xfail=no ( printf "%s\n" "449. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %union { float fval; int ival; }; %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = 0.2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_449 #AT_START_450 at_fn_group_banner 450 'types.at:139' \ "glr2.cc %union { float fval; int ival; }; %header" "" 15 at_xfail=no ( printf "%s\n" "450. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %union { float fval; int ival; }; %header %token '1'; %token '2'; %% start: '1' '2' { printf ("%d %2.1f\n", $1, $2); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "12"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') (*lvalp).ival = 10; else if (res == '2') (*lvalp).fval = 0.2f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_450 #AT_START_451 at_fn_group_banner 451 'types.at:139' \ "glr2.cc api.value.type=union" " " 15 at_xfail=no ( printf "%s\n" "451. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type union %token ONE 101; %token TWO 102 THREE 103; %printer { yyo << $$; } %printer { yyo << $$; } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (*lvalp).ONE = 10; else if (res == 102) (*lvalp).TWO = .2f; else if (res == 103) (*lvalp).THREE = 3.3f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_451 #AT_START_452 at_fn_group_banner 452 'types.at:139' \ "glr2.cc api.value.type=union %header" " " 15 at_xfail=no ( printf "%s\n" "452. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %code { # include # include static int yylex (yy::parser::value_type *lvalp); } %skeleton "glr2.cc" %define api.value.type union %header %token ONE 101; %token TWO 102 THREE 103; %printer { yyo << $$; } %printer { yyo << $$; } %% start: ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { 101, 102, 103, EOF }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 101) (*lvalp).ONE = 10; else if (res == 102) (*lvalp).TWO = .2f; else if (res == 103) (*lvalp).THREE = 3.3f; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: ./check" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y" "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/types.at:139: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/types.at:139: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "types.at:139" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/types.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "types.at:139" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" printf "%s\n" "types.at:139" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/types.at:139" { set +x printf "%s\n" "$at_srcdir/types.at:139: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "types.at:139" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "types.at:139" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10 0.2 3.3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/types.at:139: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "types.at:139" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/types.at:139" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_452 #AT_START_453 at_fn_group_banner 453 'types.at:377' \ "lalr1.cc: Named %union" " " 15 at_xfail=no ( printf "%s\n" "453. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "lalr1.cc" %union foo { float fval; int ival; }; %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/types.at:377: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "types.at:377" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-10: error: named %union is invalid in C++ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/types.at:377" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_453 #AT_START_454 at_fn_group_banner 454 'types.at:377' \ "glr.cc: Named %union" " " 15 at_xfail=no ( printf "%s\n" "454. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "glr.cc" %union foo { float fval; int ival; }; %% exp: %empty; _ATEOF { set +x printf "%s\n" "$at_srcdir/types.at:377: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "types.at:377" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.8-10: error: named %union is invalid in C++ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/types.at:377" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_454 #AT_START_455 at_fn_group_banner 455 'scanner.at:326' \ "Token numbers: yacc.c" " " 16 at_xfail=no ( printf "%s\n" "455. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "yacc.c" %debug %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* abort */ int yylex (void) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (yylval).val = c - '0'; return NUM; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '(': return LPAR; case ')': return RPAR; case 0: return 0; } abort (); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "scanner.at:326" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.c" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_455 #AT_START_456 at_fn_group_banner 456 'scanner.at:326' \ "Token numbers: yacc.c api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "456. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "yacc.c" %define api.token.raw %debug %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* abort */ int yylex (void) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (yylval).val = c - '0'; return NUM; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '(': return LPAR; case ')': return RPAR; case 0: return 0; } abort (); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "scanner.at:326" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.c" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_456 #AT_START_457 at_fn_group_banner 457 'scanner.at:326' \ "Token numbers: glr.c" " " 16 at_xfail=no ( printf "%s\n" "457. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.c" %debug %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* abort */ int yylex (void) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (yylval).val = c - '0'; return NUM; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '(': return LPAR; case ')': return RPAR; case 0: return 0; } abort (); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "scanner.at:326" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.c" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_457 #AT_START_458 at_fn_group_banner 458 'scanner.at:326' \ "Token numbers: glr.c api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "458. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.c" %define api.token.raw %debug %code { #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include /* abort */ int yylex (void) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (yylval).val = c - '0'; return NUM; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '(': return LPAR; case ')': return RPAR; case 0: return 0; } abort (); } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "scanner.at:326" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.c" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_458 #AT_START_459 at_fn_group_banner 459 'scanner.at:326' \ "Token numbers: lalr1.cc" " " 16 at_xfail=no ( printf "%s\n" "459. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %debug %code { #include static int yylex (yy::parser::value_type *lvalp); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ int yylex (yy::parser::value_type *lvalp) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*lvalp).val = c - '0'; return yy::parser::token::NUM; case '+': return yy::parser::token::PLUS; case '-': return yy::parser::token::MINUS; case '*': return yy::parser::token::STAR; case '/': return yy::parser::token::SLASH; case '(': return yy::parser::token::LPAR; case ')': return yy::parser::token::RPAR; case 0: return yy::parser::token::END; } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:326" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_459 #AT_START_460 at_fn_group_banner 460 'scanner.at:326' \ "Token numbers: lalr1.cc api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "460. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.token.raw %debug %code { #include static int yylex (yy::parser::value_type *lvalp); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ int yylex (yy::parser::value_type *lvalp) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*lvalp).val = c - '0'; return yy::parser::token::NUM; case '+': return yy::parser::token::PLUS; case '-': return yy::parser::token::MINUS; case '*': return yy::parser::token::STAR; case '/': return yy::parser::token::SLASH; case '(': return yy::parser::token::LPAR; case ')': return yy::parser::token::RPAR; case 0: return yy::parser::token::END; } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:326" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_460 #AT_START_461 at_fn_group_banner 461 'scanner.at:326' \ "Token numbers: glr.cc" " " 16 at_xfail=no ( printf "%s\n" "461. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %debug %code { #include static int yylex (yy::parser::value_type *lvalp); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ int yylex (yy::parser::value_type *lvalp) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*lvalp).val = c - '0'; return yy::parser::token::NUM; case '+': return yy::parser::token::PLUS; case '-': return yy::parser::token::MINUS; case '*': return yy::parser::token::STAR; case '/': return yy::parser::token::SLASH; case '(': return yy::parser::token::LPAR; case ')': return yy::parser::token::RPAR; case 0: return yy::parser::token::END; } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:326" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_461 #AT_START_462 at_fn_group_banner 462 'scanner.at:326' \ "Token numbers: glr.cc api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "462. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %define api.token.raw %debug %code { #include static int yylex (yy::parser::value_type *lvalp); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ int yylex (yy::parser::value_type *lvalp) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*lvalp).val = c - '0'; return yy::parser::token::NUM; case '+': return yy::parser::token::PLUS; case '-': return yy::parser::token::MINUS; case '*': return yy::parser::token::STAR; case '/': return yy::parser::token::SLASH; case '(': return yy::parser::token::LPAR; case ')': return yy::parser::token::RPAR; case 0: return yy::parser::token::END; } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:326" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_462 #AT_START_463 at_fn_group_banner 463 'scanner.at:326' \ "Token numbers: glr2.cc" " " 16 at_xfail=no ( printf "%s\n" "463. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr2.cc" %debug %code { #include static int yylex (yy::parser::value_type *lvalp); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ int yylex (yy::parser::value_type *lvalp) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*lvalp).val = c - '0'; return yy::parser::token::NUM; case '+': return yy::parser::token::PLUS; case '-': return yy::parser::token::MINUS; case '*': return yy::parser::token::STAR; case '/': return yy::parser::token::SLASH; case '(': return yy::parser::token::LPAR; case ')': return yy::parser::token::RPAR; case 0: return yy::parser::token::END; } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" printf "%s\n" "scanner.at:326" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:326" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_463 #AT_START_464 at_fn_group_banner 464 'scanner.at:326' \ "Token numbers: glr2.cc api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "464. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr2.cc" %define api.token.raw %debug %code { #include static int yylex (yy::parser::value_type *lvalp); } %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ int yylex (yy::parser::value_type *lvalp) { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': (*lvalp).val = c - '0'; return yy::parser::token::NUM; case '+': return yy::parser::token::PLUS; case '-': return yy::parser::token::MINUS; case '*': return yy::parser::token::STAR; case '/': return yy::parser::token::SLASH; case '(': return yy::parser::token::LPAR; case ')': return yy::parser::token::RPAR; case 0: return yy::parser::token::END; } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" printf "%s\n" "scanner.at:326" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:326" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_464 #AT_START_465 at_fn_group_banner 465 'scanner.at:326' \ "Token numbers: lalr1.d" " " 16 at_xfail=no ( printf "%s\n" "465. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "lalr1.d" %debug %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } import std.range.primitives; import std.stdio; auto yyLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new YYLexer!R(range); } auto yyLexer () { return yyLexer("0-(1+2)*3/9"); } class YYLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } Symbol yylex () { import std.uni : isNumber; // Handle EOF. if (input.empty) return Symbol(TokenKind.END); auto c = input.front; input.popFront; // Numbers. switch (c) { case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': return Symbol(TokenKind.NUM, c - '0'); case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); default: assert(0); } } } int main () { auto l = yyLexer (); auto p = new YYParser (l); return !p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.d input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.d input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.d input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$DC \$DCFLAGS -ofinput input.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofinput input.d" "scanner.at:326" ( $at_check_trace; $DC $DCFLAGS -ofinput input.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.d" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_465 #AT_START_466 at_fn_group_banner 466 'scanner.at:326' \ "Token numbers: lalr1.d api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "466. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "lalr1.d" %define api.token.raw %debug %union { int val; } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } import std.range.primitives; import std.stdio; auto yyLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new YYLexer!R(range); } auto yyLexer () { return yyLexer("0-(1+2)*3/9"); } class YYLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } Symbol yylex () { import std.uni : isNumber; // Handle EOF. if (input.empty) return Symbol(TokenKind.END); auto c = input.front; input.popFront; // Numbers. switch (c) { case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': return Symbol(TokenKind.NUM, c - '0'); case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); default: assert(0); } } } int main () { auto l = yyLexer (); auto p = new YYParser (l); return !p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.d input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.d input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.d input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.d input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.d input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$DC \$DCFLAGS -ofinput input.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofinput input.d" "scanner.at:326" ( $at_check_trace; $DC $DCFLAGS -ofinput input.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.d" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:326" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_466 #AT_START_467 at_fn_group_banner 467 'scanner.at:326' \ "Token numbers: lalr1.java" " " 16 at_xfail=no ( printf "%s\n" "467. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "lalr1.java" %debug %define api.prefix {Calc} %define api.parser.class {Calc} %code imports { import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.io.Reader; import java.io.StreamTokenizer; } %token NUM "number" %type exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { System.out.println ($1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer(InputStream is) { st = new StreamTokenizer(new StringReader("0-(1+2)*3/9")); st.resetSyntax(); st.eolIsSignificant(true); st.whitespaceChars('\t', '\t'); st.whitespaceChars(' ', ' '); st.wordChars('0', '9'); } public void yyerror(String s) { System.err.println(s); } Integer yylval; public Object getLVal() { return yylval; } public int yylex() throws IOException { int ttype = st.nextToken(); switch (ttype) { case StreamTokenizer.TT_EOF: return EOF; case StreamTokenizer.TT_EOL: return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '(': return LPAR; case ')': return RPAR; default: throw new AssertionError("invalid character: " + ttype); } } } class input { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); //p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" printf "%s\n" "scanner.at:326" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$SHELL ../../../javacomp.sh input.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh input.java" "scanner.at:326" ( $at_check_trace; $SHELL ../../../javacomp.sh input.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.java" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$SHELL ../../../javaexec.sh input" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh input" "scanner.at:326" ( $at_check_trace; $SHELL ../../../javaexec.sh input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_467 #AT_START_468 at_fn_group_banner 468 'scanner.at:326' \ "Token numbers: lalr1.java api.token.raw" " " 16 at_xfail=no ( printf "%s\n" "468. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %skeleton "lalr1.java" %define api.token.raw %debug %define api.prefix {Calc} %define api.parser.class {Calc} %code imports { import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.io.Reader; import java.io.StreamTokenizer; } %token NUM "number" %type exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { System.out.println ($1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer(InputStream is) { st = new StreamTokenizer(new StringReader("0-(1+2)*3/9")); st.resetSyntax(); st.eolIsSignificant(true); st.whitespaceChars('\t', '\t'); st.whitespaceChars(' ', ' '); st.wordChars('0', '9'); } public void yyerror(String s) { System.err.println(s); } Integer yylval; public Object getLVal() { return yylval; } public int yylex() throws IOException { int ttype = st.nextToken(); switch (ttype) { case StreamTokenizer.TT_EOF: return EOF; case StreamTokenizer.TT_EOL: return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '(': return LPAR; case ')': return RPAR; default: throw new AssertionError("invalid character: " + ttype); } } } class input { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); //p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y" "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y" at_fn_check_prepare_trace "scanner.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:326" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" printf "%s\n" "scanner.at:326" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:326" { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$SHELL ../../../javacomp.sh input.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh input.java" "scanner.at:326" ( $at_check_trace; $SHELL ../../../javacomp.sh input.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.java" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:326" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:326: \$SHELL ../../../javaexec.sh input" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh input" "scanner.at:326" ( $at_check_trace; $SHELL ../../../javaexec.sh input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:326" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_468 #AT_START_469 at_fn_group_banner 469 'scanner.at:330' \ "Token numbers: lalr1.cc api.token.raw api.value.type=variant api.token.constructor" "" 16 at_xfail=no ( printf "%s\n" "469. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.token.raw %define api.value.type variant %define api.token.constructor %debug %code { #include static yy::parser::symbol_type yylex (); } %token NUM "number" %nterm exp %token PLUS "+" MINUS "-" STAR "*" SLASH "/" LPAR "(" RPAR ")" END 0 %left "+" "-" %left "*" "/" %% input : exp { printf ("%d\n", $1); } ; exp : exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { $$ = $1 / $3; } | "(" exp ")" { $$ = $2; } | "number" { $$ = $1; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include /* abort */ yy::parser::symbol_type yylex () { static const char* input = "0-(1+2)*3/9"; int c = *input++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return yy::parser::make_NUM (c - '0'); case '+': return yy::parser::make_PLUS (); case '-': return yy::parser::make_MINUS (); case '*': return yy::parser::make_STAR (); case '/': return yy::parser::make_SLASH (); case '(': return yy::parser::make_LPAR (); case ')': return yy::parser::make_RPAR (); case 0: return yy::parser::make_END (); } abort (); } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/scanner.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "scanner.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "scanner.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/scanner.at:330: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:330" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/scanner.at:330: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "scanner.at:330" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/scanner.at:330: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "scanner.at:330" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/scanner.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "scanner.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "scanner.at:330" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/scanner.at:330" { set +x printf "%s\n" "$at_srcdir/scanner.at:330: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "scanner.at:330" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } # When api.token.raw, the yytranslate table should not be included. # # yacc.c, glr.c and glr.cc use 'yytranslate' (and YYTRANSLATE). # lalr1.cc uses 'translate_table' (and yytranslate_). # lalr1.d uses 'byte[] translate_table =' (and yytranslate_). # lalr1.java uses 'byte[] translate_table_ =' (and yytranslate_). { set +x printf "%s\n" "$at_srcdir/scanner.at:330: \$EGREP -c 'yytranslate\\[\\]|translate_table\\[\\]|translate_table =|translate_table_ =' input.cc" at_fn_check_prepare_notrace 'a shell pipeline' "scanner.at:330" ( $at_check_trace; $EGREP -c 'yytranslate\[\]|translate_table\[\]|translate_table =|translate_table_ =' input.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:330: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "scanner.at:330" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "-1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/scanner.at:330: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "scanner.at:330" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/scanner.at:330" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_469 #AT_START_470 at_fn_group_banner 470 'calc.at:1334' \ "Calculator parse.trace " " " 17 at_xfail=no ( printf "%s\n" "470. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.trace %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); yydebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1334" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1334" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1334" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1334: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1334" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1334" { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1334" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1334" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1334" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1334" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1334" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1334: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1334" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1334: cat stderr" at_fn_check_prepare_trace "calc.at:1334" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1334" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_470 #AT_START_471 at_fn_group_banner 471 'calc.at:1336' \ "Calculator %header " " " 17 at_xfail=no ( printf "%s\n" "471. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %header %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1336" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1336" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1336: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1336" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1336" { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1336" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1336" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1336" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1336" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1336" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1336: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1336" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1336: cat stderr" at_fn_check_prepare_trace "calc.at:1336" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1336" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_471 #AT_START_472 at_fn_group_banner 472 'calc.at:1337' \ "Calculator %debug %locations " " " 17 at_xfail=no ( printf "%s\n" "472. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %debug %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last_line++; (yylloc).last_column = 1; } else (yylloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first_column = (yylloc).last_column; (yylloc).first_line = (yylloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first_line, (yylloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); yydebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1337" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1337" { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1337" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1337" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1337" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1337" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1337" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1337: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1337" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1337: cat stderr" at_fn_check_prepare_trace "calc.at:1337" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1337" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_472 #AT_START_473 at_fn_group_banner 473 'calc.at:1338' \ "Calculator %locations api.location.type={Span} " "" 17 at_xfail=no ( printf "%s\n" "473. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %locations %define api.location.type {Span} %code requires { typedef struct { int l; int c; } Point; typedef struct { Point first; Point last; } Span; # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = YYRHSLOC (Rhs, 1).first; \ (Current).last = YYRHSLOC (Rhs, N).last; \ } \ else \ { \ (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \ } \ while (0) #include void location_print (FILE *o, Span s); #define LOCATION_PRINT location_print /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } %initial-action { @$.first.l = @$.first.c = 1; @$.last = @$.first; } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } void location_print (FILE *o, Span s) { fprintf (o, "%d.%d", s.first.l, s.first.c); if (s.first.l != s.last.l) fprintf (o, "-%d.%d", s.last.l, s.last.c - 1); else if (s.first.c != s.last.c - 1) fprintf (o, "-%d", s.last.c - 1); } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last.l++; (yylloc).last.c = 1; } else (yylloc).last.c++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first.c = (yylloc).last.c; (yylloc).first.l = (yylloc).last.l; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first.l, (yylloc).first.c); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1338" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1338" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1338: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1338" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1338" { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1338" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1338" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1338" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1338" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1338" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1338: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1338" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1338: cat stderr" at_fn_check_prepare_trace "calc.at:1338" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1338" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_473 #AT_START_474 at_fn_group_banner 474 'calc.at:1340' \ "Calculator %name-prefix \"calc\" " " " 17 at_xfail=no ( printf "%s\n" "474. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %name-prefix "calc" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void calcerror (const char *msg); int calclex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int calclex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1340" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1340" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1340: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1340" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1340" { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1340" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1340" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1340" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1340" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1340" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1340: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1340" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1340: cat stderr" at_fn_check_prepare_trace "calc.at:1340" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1340" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_474 #AT_START_475 at_fn_group_banner 475 'calc.at:1341' \ "Calculator %verbose " " " 17 at_xfail=no ( printf "%s\n" "475. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1341" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1341: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1341" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1341" { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1341" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1341" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1341" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1341" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1341" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1341: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1341" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1341: cat stderr" at_fn_check_prepare_trace "calc.at:1341" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1341" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_475 #AT_START_476 at_fn_group_banner 476 'calc.at:1342' \ "Calculator %yacc " " " 17 at_xfail=no ( printf "%s\n" "476. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1342" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1342" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1342: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1342" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1342" { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1342" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1342" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1342" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1342" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1342" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1342: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1342" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1342: cat stderr" at_fn_check_prepare_trace "calc.at:1342" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1342" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_476 #AT_START_477 at_fn_group_banner 477 'calc.at:1343' \ "Calculator parse.error=detailed " " " 17 at_xfail=no ( printf "%s\n" "477. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error detailed %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1343" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1343" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1343" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1343: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1343" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1343" { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1343" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1343" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1343" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1343" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1343" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1343: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1343" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1343: cat stderr" at_fn_check_prepare_trace "calc.at:1343" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1343" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_477 #AT_START_478 at_fn_group_banner 478 'calc.at:1344' \ "Calculator parse.error=verbose " " " 17 at_xfail=no ( printf "%s\n" "478. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1344" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1344" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1344" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1344: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1344" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1344" { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1344" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1344" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1344" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1344" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1344" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1344: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1344" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1344: cat stderr" at_fn_check_prepare_trace "calc.at:1344" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1344" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_478 #AT_START_479 at_fn_group_banner 479 'calc.at:1346' \ "Calculator api.pure=full %locations " " " 17 at_xfail=no ( printf "%s\n" "479. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define api.pure full %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1346" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1346" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1346" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1346: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1346" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1346" { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1346" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1346" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1346" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1346" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1346" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1346: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1346" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1346: cat stderr" at_fn_check_prepare_trace "calc.at:1346" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1346" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_479 #AT_START_480 at_fn_group_banner 480 'calc.at:1347' \ "Calculator api.push-pull=both api.pure=full %locations " "" 17 at_xfail=no ( printf "%s\n" "480. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define api.push-pull both %define api.pure full %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1347" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1347" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1347" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1347: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1347" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1347" { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1347" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1347" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1347" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1347" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1347" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1347: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1347" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1347: cat stderr" at_fn_check_prepare_trace "calc.at:1347" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1347" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_480 #AT_START_481 at_fn_group_banner 481 'calc.at:1348' \ "Calculator parse.error=detailed %locations " " " 17 at_xfail=no ( printf "%s\n" "481. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error detailed %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last_line++; (yylloc).last_column = 1; } else (yylloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first_column = (yylloc).last_column; (yylloc).first_line = (yylloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first_line, (yylloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1348" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1348" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1348" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1348: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1348" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1348" { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1348" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1348" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1348" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1348" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1348" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1348: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1348" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1348: cat stderr" at_fn_check_prepare_trace "calc.at:1348" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1348" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_481 #AT_START_482 at_fn_group_banner 482 'calc.at:1350' \ "Calculator parse.error=detailed %locations %header api.prefix={calc} %verbose %yacc " "" 17 at_xfail=no ( printf "%s\n" "482. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error detailed %locations %header %define api.prefix {calc} %verbose %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static CALCLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1350" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1350" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1350" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1350: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1350" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1350" { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1350" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1350" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1350" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1350" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1350" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1350: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1350" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1350: cat stderr" at_fn_check_prepare_trace "calc.at:1350" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1350" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_482 #AT_START_483 at_fn_group_banner 483 'calc.at:1351' \ "Calculator parse.error=detailed %locations %header %name-prefix \"calc\" api.token.prefix={TOK_} %verbose %yacc " "" 17 at_xfail=no ( printf "%s\n" "483. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error detailed %locations %header %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return TOK_NUM; } /* Return end-of-file. */ if (c == EOF) return TOK_CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return TOK_YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1351" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1351" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1351" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1351: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1351" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1351" { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1351" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1351" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1351" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1351" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1351" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1351: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1351" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1351: cat stderr" at_fn_check_prepare_trace "calc.at:1351" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1351" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_483 #AT_START_484 at_fn_group_banner 484 'calc.at:1353' \ "Calculator %debug " " " 17 at_xfail=no ( printf "%s\n" "484. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %debug %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); yydebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1353" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1353" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1353" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1353: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1353" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1353" { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1353" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1353" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1353" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1353" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1353" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1353: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1353" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1353: cat stderr" at_fn_check_prepare_trace "calc.at:1353" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1353" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_484 #AT_START_485 at_fn_group_banner 485 'calc.at:1354' \ "Calculator parse.error=detailed %debug %locations %header %name-prefix \"calc\" %verbose %yacc " "" 17 at_xfail=no ( printf "%s\n" "485. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error detailed %debug %locations %header %name-prefix "calc" %verbose %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1354" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1354" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1354" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1354" { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1354" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1354" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1354" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1354" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1354" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1354" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1354: cat stderr" at_fn_check_prepare_trace "calc.at:1354" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1354" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_485 #AT_START_486 at_fn_group_banner 486 'calc.at:1355' \ "Calculator parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc " "" 17 at_xfail=no ( printf "%s\n" "486. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static CALCLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1355" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1355" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1355" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1355" { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1355" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1355" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1355" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1355" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1355" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1355" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1355: cat stderr" at_fn_check_prepare_trace "calc.at:1355" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1355" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_486 #AT_START_487 at_fn_group_banner 487 'calc.at:1357' \ "Calculator api.pure=full parse.error=detailed %debug %locations %header %name-prefix \"calc\" %verbose %yacc " "" 17 at_xfail=no ( printf "%s\n" "487. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define api.pure full %define parse.error detailed %debug %locations %header %name-prefix "calc" %verbose %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, const char *msg); int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1357" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1357" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1357" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1357" { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1357" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1357" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1357" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1357" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1357" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1357: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1357" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1357: cat stderr" at_fn_check_prepare_trace "calc.at:1357" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1357" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_487 #AT_START_488 at_fn_group_banner 488 'calc.at:1358' \ "Calculator api.push-pull=both api.pure=full parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc " "" 17 at_xfail=no ( printf "%s\n" "488. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define api.push-pull both %define api.pure full %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1358" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1358" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1358" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1358: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1358" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1358" { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1358" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1358" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1358" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1358" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1358" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1358: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1358" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1358: cat stderr" at_fn_check_prepare_trace "calc.at:1358" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1358" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_488 #AT_START_489 at_fn_group_banner 489 'calc.at:1360' \ "Calculator api.pure parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 17 at_xfail=no ( printf "%s\n" "489. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define api.pure %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1360" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1360" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1360" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1360" { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1360" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1360" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1360" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1360" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1360" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1360" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1360: cat stderr" at_fn_check_prepare_trace "calc.at:1360" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_489 #AT_START_490 at_fn_group_banner 490 'calc.at:1362' \ "Calculator %no-lines api.pure parse.error=detailed %debug %locations %header api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 17 at_xfail=no ( printf "%s\n" "490. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %no-lines %define api.pure %define parse.error detailed %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1362" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1362" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1362" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1362: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1362" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1362" { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1362" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1362" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1362" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1362" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1362" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1362" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1362: cat stderr" at_fn_check_prepare_trace "calc.at:1362" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_490 #AT_START_491 at_fn_group_banner 491 'calc.at:1363' \ "Calculator %no-lines api.pure parse.error=verbose %debug %locations %header api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 17 at_xfail=no ( printf "%s\n" "491. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %no-lines %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1363" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1363" { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1363" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1363" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1363" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1363" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1363" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1363" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1363: cat stderr" at_fn_check_prepare_trace "calc.at:1363" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_491 #AT_START_492 at_fn_group_banner 492 'calc.at:1364' \ "Calculator %no-lines api.pure parse.error=verbose %debug %locations %defines api.prefix={calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 17 at_xfail=no ( printf "%s\n" "492. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: if \"\$POSIXLY_CORRECT_IS_EXPORTED\"; then sed -e '/\\/\\* !POSIX \\*\\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; if "$POSIXLY_CORRECT_IS_EXPORTED"; then sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y else mv calc.y.tmp calc.y fi ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1364" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1364" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1364" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1364: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1364" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1364" { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1364" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1364" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1364" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1364" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1364" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1364: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1364" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1364: cat stderr" at_fn_check_prepare_trace "calc.at:1364" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1364" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_492 #AT_START_493 at_fn_group_banner 493 'calc.at:1367' \ "Calculator parse.error=custom " " " 17 at_xfail=no ( printf "%s\n" "493. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error custom %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } int yyreport_syntax_error (const yypcontext_t *ctx) { int res = 0; fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1367" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1367" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1367" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1367" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1367" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1367: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1367" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1367" { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1367" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1367" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1367" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1367" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1367" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1367" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1367: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1367: cat stderr" at_fn_check_prepare_trace "calc.at:1367" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1367" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_493 #AT_START_494 at_fn_group_banner 494 'calc.at:1368' \ "Calculator parse.error=custom %locations api.prefix={calc} " "" 17 at_xfail=no ( printf "%s\n" "494. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error custom %locations %define api.prefix {calc} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx) { int res = 0; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int calclex (void); static CALCLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1368" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1368" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1368" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1368: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1368" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1368" { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1368" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1368" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1368" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1368" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1368" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1368" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1368: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1368: cat stderr" at_fn_check_prepare_trace "calc.at:1368" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1368" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_494 #AT_START_495 at_fn_group_banner 495 'calc.at:1369' \ "Calculator parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 17 at_xfail=no ( printf "%s\n" "495. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (result, count, nerrs, buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror (result, count, nerrs, "error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx, semantic_value *result, int *count, int *nerrs) { int res = 0; YY_USE (result); YY_USE (count); YY_USE (nerrs); ++global_nerrs; ++*nerrs; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } #include int calclex (void); static CALCLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1369" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1369" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1369" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1369: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1369" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1369" { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1369" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1369" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1369" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1369" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1369" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1369" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1369: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1369: cat stderr" at_fn_check_prepare_trace "calc.at:1369" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1369" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_495 #AT_START_496 at_fn_group_banner 496 'calc.at:1370' \ "Calculator parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} api.push-pull=both api.pure=full " "" 17 at_xfail=no ( printf "%s\n" "496. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %define api.push-pull both %define api.pure full %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx, semantic_value *result, int *count, int *nerrs) { int res = 0; YY_USE (result); YY_USE (count); YY_USE (nerrs); ++global_nerrs; ++*nerrs; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1370" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1370" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1370" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1370: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1370" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1370" { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1370" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1370" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1370" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1370" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1370" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1370" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1370: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1370: cat stderr" at_fn_check_prepare_trace "calc.at:1370" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1370" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_496 #AT_START_497 at_fn_group_banner 497 'calc.at:1371' \ "Calculator parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} api.push-pull=both api.pure=full parse.lac=full " "" 17 at_xfail=no ( printf "%s\n" "497. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %define api.push-pull both %define api.pure full %define parse.lac full %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx, semantic_value *result, int *count, int *nerrs) { int res = 0; YY_USE (result); YY_USE (count); YY_USE (nerrs); ++global_nerrs; ++*nerrs; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1371" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1371" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1371" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1371" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1371" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1371: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1371" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1371" { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1371" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1371" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1371" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1371" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1371" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1371" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1371: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1371: cat stderr" at_fn_check_prepare_trace "calc.at:1371" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1371" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_497 #AT_START_498 at_fn_group_banner 498 'calc.at:1374' \ "Calculator %start input exp NUM api.value.type=union " "" 17 at_xfail=no ( printf "%s\n" "498. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %start input exp NUM %define api.value.type union %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).NUM = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { if (!strcmp (argv[i], "--exp") && i+1 < argc) { input = open_file (argv[i+1]); ignore_eol = 1; yyparse_exp_t res = yyparse_exp (); printf ("exp => %d (status: %d, errors: %d)\n", res.yystatus == 0 ? res.yyvalue : 0, res.yystatus, res.yynerrs); status = res.yystatus; ++i; } else if (!strcmp (argv[i], "--num") && i+1 < argc) { input = open_file (argv[i+1]); ignore_eol = 1; yyparse_NUM_t res = yyparse_NUM (); printf ("NUM => %d (status: %d, errors: %d)\n", res.yystatus == 0 ? res.yyvalue : 0, res.yystatus, res.yynerrs); status = res.yystatus; ++i; } else { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1374" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1374" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1374: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1374" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1374" { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1374" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1374" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1374" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1374" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1374" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. cat >input <<'_ATEOF' 123 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "NUM => 123 (status: 0, errors: 0) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1374" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 + 2 * 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "NUM => 0 (status: 1, errors: 1) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error, unexpected '+', expecting end of file _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1374" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1374: cat stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 + 2 * 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "exp => 7 (status: 0, errors: 0) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1374" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1374: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1374" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1374" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_498 #AT_START_499 at_fn_group_banner 499 'calc.at:1375' \ "Calculator %start input exp NUM api.value.type=union %locations parse.error=detailed " "" 17 at_xfail=no ( printf "%s\n" "499. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %start input exp NUM %define api.value.type union %locations %define parse.error detailed %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last_line++; (yylloc).last_column = 1; } else (yylloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first_column = (yylloc).last_column; (yylloc).first_line = (yylloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).NUM = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first_line, (yylloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { if (!strcmp (argv[i], "--exp") && i+1 < argc) { input = open_file (argv[i+1]); ignore_eol = 1; yyparse_exp_t res = yyparse_exp (); printf ("exp => %d (status: %d, errors: %d)\n", res.yystatus == 0 ? res.yyvalue : 0, res.yystatus, res.yynerrs); status = res.yystatus; ++i; } else if (!strcmp (argv[i], "--num") && i+1 < argc) { input = open_file (argv[i+1]); ignore_eol = 1; yyparse_NUM_t res = yyparse_NUM (); printf ("NUM => %d (status: %d, errors: %d)\n", res.yystatus == 0 ? res.yyvalue : 0, res.yystatus, res.yynerrs); status = res.yystatus; ++i; } else { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1375" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1375" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1375" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1375: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1375" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1375" { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1375" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # No direct calls to malloc/free. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$EGREP '(malloc|free) *\\(' calc.[ch] | \$EGREP -v 'INFRINGES ON USER NAME SPACE'" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1375" ( $at_check_trace; $EGREP '(malloc|free) *\(' calc.[ch] | $EGREP -v 'INFRINGES ON USER NAME SPACE' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1375" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1375" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1375" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. cat >input <<'_ATEOF' 123 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "NUM => 123 (status: 0, errors: 0) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1375" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 + 2 * 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "NUM => 0 (status: 1, errors: 1) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error, unexpected '+', expecting end of file _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1375" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1375: cat stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 + 2 * 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "exp => 7 (status: 0, errors: 0) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1375" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1375: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1375" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1375" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_499 #AT_START_500 at_fn_group_banner 500 'calc.at:1387' \ "Calculator %glr-parser " " " 18 at_xfail=no ( printf "%s\n" "500. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1387" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1387" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1387" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1387: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1387" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1387" { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1387" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1387" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1387: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1387" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1387: cat stderr" at_fn_check_prepare_trace "calc.at:1387" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1387" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_500 #AT_START_501 at_fn_group_banner 501 'calc.at:1389' \ "Calculator %glr-parser %header " " " 18 at_xfail=no ( printf "%s\n" "501. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %header %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1389" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1389" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1389" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1389: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1389" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1389" { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1389" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1389" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1389: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1389" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1389: cat stderr" at_fn_check_prepare_trace "calc.at:1389" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1389" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_501 #AT_START_502 at_fn_group_banner 502 'calc.at:1390' \ "Calculator %glr-parser %locations " " " 18 at_xfail=no ( printf "%s\n" "502. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last_line++; (yylloc).last_column = 1; } else (yylloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first_column = (yylloc).last_column; (yylloc).first_line = (yylloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first_line, (yylloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1390" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1390" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1390" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1390: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1390" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1390" { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1390" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1390" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1390: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1390" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1390: cat stderr" at_fn_check_prepare_trace "calc.at:1390" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1390" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_502 #AT_START_503 at_fn_group_banner 503 'calc.at:1391' \ "Calculator %glr-parser %locations api.location.type={Span} " "" 18 at_xfail=no ( printf "%s\n" "503. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %locations %define api.location.type {Span} %code requires { typedef struct { int l; int c; } Point; typedef struct { Point first; Point last; } Span; # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = YYRHSLOC (Rhs, 1).first; \ (Current).last = YYRHSLOC (Rhs, N).last; \ } \ else \ { \ (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \ } \ while (0) #include void location_print (FILE *o, Span s); #define LOCATION_PRINT location_print /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } %initial-action { @$.first.l = @$.first.c = 1; @$.last = @$.first; } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } void location_print (FILE *o, Span s) { fprintf (o, "%d.%d", s.first.l, s.first.c); if (s.first.l != s.last.l) fprintf (o, "-%d.%d", s.last.l, s.last.c - 1); else if (s.first.c != s.last.c - 1) fprintf (o, "-%d", s.last.c - 1); } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last.l++; (yylloc).last.c = 1; } else (yylloc).last.c++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first.c = (yylloc).last.c; (yylloc).first.l = (yylloc).last.l; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first.l, (yylloc).first.c); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1391" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1391" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1391" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1391: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1391" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1391" { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1391" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1391" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1391: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1391" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1391: cat stderr" at_fn_check_prepare_trace "calc.at:1391" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1391" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_503 #AT_START_504 at_fn_group_banner 504 'calc.at:1392' \ "Calculator %glr-parser %name-prefix \"calc\" " " " 18 at_xfail=no ( printf "%s\n" "504. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %name-prefix "calc" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void calcerror (const char *msg); int calclex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int calclex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1392" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1392" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1392" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1392: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1392" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1392" { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1392" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1392" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1392: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1392" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1392: cat stderr" at_fn_check_prepare_trace "calc.at:1392" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1392" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_504 #AT_START_505 at_fn_group_banner 505 'calc.at:1393' \ "Calculator %glr-parser api.prefix={calc} " " " 18 at_xfail=no ( printf "%s\n" "505. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define api.prefix {calc} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void calcerror (const char *msg); int calclex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int calclex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1393" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1393" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1393" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1393: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1393" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1393" { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1393" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1393" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1393: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1393" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1393: cat stderr" at_fn_check_prepare_trace "calc.at:1393" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1393" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_505 #AT_START_506 at_fn_group_banner 506 'calc.at:1394' \ "Calculator %glr-parser %verbose " " " 18 at_xfail=no ( printf "%s\n" "506. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1394" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1394" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1394" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1394: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1394" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1394" { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1394" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1394" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1394" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1394: cat stderr" at_fn_check_prepare_trace "calc.at:1394" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1394" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_506 #AT_START_507 at_fn_group_banner 507 'calc.at:1395' \ "Calculator %glr-parser parse.error=verbose " " " 18 at_xfail=no ( printf "%s\n" "507. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1395" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1395" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1395" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1395: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1395" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1395" { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1395" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1395" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1395" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1395: cat stderr" at_fn_check_prepare_trace "calc.at:1395" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1395" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_507 #AT_START_508 at_fn_group_banner 508 'calc.at:1397' \ "Calculator %glr-parser api.pure %locations " " " 18 at_xfail=no ( printf "%s\n" "508. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define api.pure %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1397" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1397" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1397" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1397: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1397" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1397" { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1397" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1397" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1397: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1397" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1397: cat stderr" at_fn_check_prepare_trace "calc.at:1397" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1397" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_508 #AT_START_509 at_fn_group_banner 509 'calc.at:1398' \ "Calculator %glr-parser parse.error=verbose %locations " "" 18 at_xfail=no ( printf "%s\n" "509. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error verbose %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include int yylex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (yylloc); if (res == '\n') { (yylloc).last_line++; (yylloc).last_column = 1; } else (yylloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (yylloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { (yylloc).first_column = (yylloc).last_column; (yylloc).first_line = (yylloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (yylloc).first_line, (yylloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1398" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1398" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1398" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1398: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1398" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1398" { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1398" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1398" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1398: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1398" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1398: cat stderr" at_fn_check_prepare_trace "calc.at:1398" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1398" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_509 #AT_START_510 at_fn_group_banner 510 'calc.at:1400' \ "Calculator %glr-parser parse.error=custom %locations %header %name-prefix \"calc\" %verbose " "" 18 at_xfail=no ( printf "%s\n" "510. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error custom %locations %header %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx) { int res = 0; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1400" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1400" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1400" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1400: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1400" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1400: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1400" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1400: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1400" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1400" { set +x printf "%s\n" "$at_srcdir/calc.at:1400: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1400" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1400: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1400" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1400" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1400: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1400: cat stderr" at_fn_check_prepare_trace "calc.at:1400" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1400" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_510 #AT_START_511 at_fn_group_banner 511 'calc.at:1401' \ "Calculator %glr-parser parse.error=custom %locations %header %name-prefix \"calc\" %verbose api.pure " "" 18 at_xfail=no ( printf "%s\n" "511. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error custom %locations %header %name-prefix "calc" %verbose %define api.pure %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, const char *msg); int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx) { int res = 0; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1401" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1401" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1401" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1401: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1401" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1401: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1401" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1401: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1401" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1401" { set +x printf "%s\n" "$at_srcdir/calc.at:1401: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1401" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1401: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1401" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1401" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1401: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1401: cat stderr" at_fn_check_prepare_trace "calc.at:1401" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1401" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_511 #AT_START_512 at_fn_group_banner 512 'calc.at:1402' \ "Calculator %glr-parser parse.error=detailed %locations %header %name-prefix \"calc\" %verbose " "" 18 at_xfail=no ( printf "%s\n" "512. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error detailed %locations %header %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1402" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1402" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1402" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1402: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1402" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1402" { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1402" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1402" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1402: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1402" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1402: cat stderr" at_fn_check_prepare_trace "calc.at:1402" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1402" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_512 #AT_START_513 at_fn_group_banner 513 'calc.at:1403' \ "Calculator %glr-parser parse.error=verbose %locations %header %name-prefix \"calc\" %verbose " "" 18 at_xfail=no ( printf "%s\n" "513. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error verbose %locations %header %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1403" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1403" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1403" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1403: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1403" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1403" { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1403" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1403" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1403: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1403" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1403: cat stderr" at_fn_check_prepare_trace "calc.at:1403" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1403" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_513 #AT_START_514 at_fn_group_banner 514 'calc.at:1405' \ "Calculator %glr-parser parse.error=custom %locations %header %name-prefix \"calc\" %verbose " "" 18 at_xfail=no ( printf "%s\n" "514. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error custom %locations %header %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif int yyreport_syntax_error (const yypcontext_t *ctx) { int res = 0; LOCATION_PRINT (stderr, *yypcontext_location (ctx)); fprintf (stderr, ": "); fprintf (stderr, "syntax error"); { yysymbol_kind_t la = yypcontext_token (ctx); if (la != YYSYMBOL_YYEMPTY) fprintf (stderr, " on token [%s]", yysymbol_name (la)); } { enum { TOKENMAX = 10 }; yysymbol_kind_t expected[TOKENMAX]; int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX); /* Forward errors to yyparse. */ if (n <= 0) res = n; else { fprintf (stderr, " (expected:"); for (int i = 0; i < n; ++i) fprintf (stderr, " [%s]", yysymbol_name (expected[i])); fprintf (stderr, ")"); } } fprintf (stderr, "\n"); return res; } /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1405" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1405" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1405" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1405: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1405" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1405: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1405" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1405: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1405" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1405" { set +x printf "%s\n" "$at_srcdir/calc.at:1405: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1405" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1405: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1405" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1405" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1405: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1405: cat stderr" at_fn_check_prepare_trace "calc.at:1405" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1405" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_514 #AT_START_515 at_fn_group_banner 515 'calc.at:1407' \ "Calculator %glr-parser %debug " " " 18 at_xfail=no ( printf "%s\n" "515. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %debug %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include /* !POSIX */ static void yyerror (const char *msg); int yylex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include int yylex (void); static int get_char (void) { int res = getc (input); ; return res; } static void unget_char ( int c) { ; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (void) { int c; /* Skip white spaces. */ do { } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (yylval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); yydebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1407" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1407" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1407" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1407: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1407" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1407" { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS" "calc.at:1407" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1407" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1407: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1407" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1407: cat stderr" at_fn_check_prepare_trace "calc.at:1407" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1407" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_515 #AT_START_516 at_fn_group_banner 516 'calc.at:1408' \ "Calculator %glr-parser parse.error=verbose %debug %locations %header %name-prefix \"calc\" %verbose " "" 18 at_xfail=no ( printf "%s\n" "516. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static YYLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1408" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1408" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1408" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1408: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1408" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1408" { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1408" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1408" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1408: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1408" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1408: cat stderr" at_fn_check_prepare_trace "calc.at:1408" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1408" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_516 #AT_START_517 at_fn_group_banner 517 'calc.at:1409' \ "Calculator %glr-parser parse.error=verbose %debug %locations %header api.prefix={calc} api.token.prefix={TOK_} %verbose " "" 18 at_xfail=no ( printf "%s\n" "517. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define parse.error verbose %debug %locations %header %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (const char *msg); int calclex (void); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); { YYLTYPE old_yylloc = yylloc; yylloc = @$; yyerror (buf); yylloc = old_yylloc; } } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { { YYLTYPE old_yylloc = yylloc; yylloc = @3; yyerror ("error: null divisor"); yylloc = old_yylloc; } } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (const char *msg) { LOCATION_PRINT (stderr, (calclloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (void); static CALCLTYPE last_yylloc; static int get_char (void) { int res = getc (input); ; last_yylloc = (calclloc); if (res == '\n') { (calclloc).last_line++; (calclloc).last_column = 1; } else (calclloc).last_column++; return res; } static void unget_char ( int c) { ; /* Wrong when C == '\n'. */ (calclloc) = last_yylloc; ungetc (c, input); } static int read_integer (void) { int c = get_char (); int res = 0; ; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (); } unget_char ( c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (void) { int c; /* Skip white spaces. */ do { (calclloc).first_column = (calclloc).last_column; (calclloc).first_line = (calclloc).last_line; } while ((c = get_char ()) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char ( c); (calclval).ival = read_integer (); return TOK_NUM; } /* Return end-of-file. */ if (c == EOF) return TOK_CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (calclloc).first_line, (calclloc).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return TOK_CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1409" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1409" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1409" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1409: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1409" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1409" { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1409" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1409" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1409: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1409" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1409: cat stderr" at_fn_check_prepare_trace "calc.at:1409" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1409" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_517 #AT_START_518 at_fn_group_banner 518 'calc.at:1411' \ "Calculator %glr-parser api.pure parse.error=verbose %debug %locations %header %name-prefix \"calc\" %verbose " "" 18 at_xfail=no ( printf "%s\n" "518. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define api.pure %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, const char *msg); int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1411" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1411" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1411" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1411: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1411" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1411" { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1411" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1411" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1411: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1411" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1411: cat stderr" at_fn_check_prepare_trace "calc.at:1411" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1411" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_518 #AT_START_519 at_fn_group_banner 519 'calc.at:1413' \ "Calculator %glr-parser api.pure parse.error=verbose %debug %locations %header %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 18 at_xfail=no ( printf "%s\n" "519. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define api.pure %define parse.error verbose %debug %locations %header %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (YYLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (YYSTYPE *lvalp, YYLTYPE *llocp); static YYLTYPE last_yylloc; static int get_char (YYSTYPE *lvalp, YYLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (YYSTYPE *lvalp, YYLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (YYSTYPE *lvalp, YYLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (YYSTYPE *lvalp, YYLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1413" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1413" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1413" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1413: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1413" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1413" { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1413" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1413" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1413: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1413" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1413: cat stderr" at_fn_check_prepare_trace "calc.at:1413" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1413" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_519 #AT_START_520 at_fn_group_banner 520 'calc.at:1414' \ "Calculator %glr-parser api.pure parse.error=verbose %debug %locations %header api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 18 at_xfail=no ( printf "%s\n" "520. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1414" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1414" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1414" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1414" { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1414" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1414" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1414: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1414" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1414: cat stderr" at_fn_check_prepare_trace "calc.at:1414" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_520 #AT_START_521 at_fn_group_banner 521 'calc.at:1416' \ "Calculator %glr-parser %no-lines api.pure parse.error=verbose %debug %locations %header api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 18 at_xfail=no ( printf "%s\n" "521. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %glr-parser %no-lines %define api.pure %define parse.error verbose %debug %locations %header %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { fprintf (yyo, "%d", $$); } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); #include #if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, CALCLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg); int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyerror (&@$, result, count, nerrs, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyerror (&@3, result, count, nerrs, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } | '!' '*' { $$ = 0; YYNOMEM; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } # if defined CALCLTYPE_IS_TRIVIAL && CALCLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, CALCLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void calcerror (CALCLTYPE const * const llocp, semantic_value *result, int *count, int *nerrs, const char *msg) { YY_USE (result); YY_USE (count); YY_USE (nerrs); LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); ++global_nerrs; ++*nerrs; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp); static CALCLTYPE last_yylloc; static int get_char (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last_line++; (*llocp).last_column = 1; } else (*llocp).last_column++; return res; } static void unget_char (CALCSTYPE *lvalp, CALCLTYPE *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (CALCSTYPE *lvalp, CALCLTYPE *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first_column = (*llocp).last_column; (*llocp).first_line = (*llocp).last_line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return NUM; } /* Return end-of-file. */ if (c == EOF) return CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first_line, (*llocp).first_column); fputs ("syntax error: invalid character: '#'\n", stderr); return CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.c <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.h" #include #include /* exit */ #include /* strcmp */ #include /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); calcdebug = 1; { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y" "calc.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1416" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1416" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.c calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1416" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1416" { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o calc calc.c calc-lex.c calc-main.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS" "calc.at:1416" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c calc-lex.c calc-main.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.c calc.h " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.c calc.h ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1416" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # YYNOMEM. cat >input <<'_ATEOF' 1 + 2 * 3 + !* ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.14: memory exhausted _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1416: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1416" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1416: cat stderr" at_fn_check_prepare_trace "calc.at:1416" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1416" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_521 #AT_START_522 at_fn_group_banner 522 'calc.at:1426' \ "Calculator lalr1.cc %header " " " 19 at_xfail=no ( printf "%s\n" "522. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "lalr1.cc" %header %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1426" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1426" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1426" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1426: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1426" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1426" { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1426" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1426" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1426" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1426" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1426: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1426" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1426: cat stderr" at_fn_check_prepare_trace "calc.at:1426" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1426" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_522 #AT_START_523 at_fn_group_banner 523 'calc.at:1431' \ "Calculator C++ " " " 19 at_xfail=no ( printf "%s\n" "523. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1431" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1431" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1431" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1431: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1431" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1431" { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1431" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1431" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1431" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1431" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1431: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1431" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1431: cat stderr" at_fn_check_prepare_trace "calc.at:1431" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1431" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_523 #AT_START_524 at_fn_group_banner 524 'calc.at:1432' \ "Calculator C++ %locations " " " 19 at_xfail=no ( printf "%s\n" "524. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1432" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1432" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1432: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1432" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1432" { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1432" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1432" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1432" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1432" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1432: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1432" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1432: cat stderr" at_fn_check_prepare_trace "calc.at:1432" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1432" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_524 #AT_START_525 at_fn_group_banner 525 'calc.at:1433' \ "Calculator C++ %locations \$NO_EXCEPTIONS_CXXFLAGS" "" 19 at_xfail=no ( printf "%s\n" "525. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1433" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1433" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1433" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1433: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1433" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1433" { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \$CXX \$CPPFLAGS \$CXXFLAGS \$NO_EXCEPTIONS_CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $NO_EXCEPTIONS_CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1433" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $NO_EXCEPTIONS_CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1433" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1433" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1433" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1433: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1433" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1433: cat stderr" at_fn_check_prepare_trace "calc.at:1433" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1433" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_525 #AT_START_526 at_fn_group_banner 526 'calc.at:1434' \ "Calculator C++ %locations api.location.type={Span} " "" 19 at_xfail=no ( printf "%s\n" "526. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define api.location.type {Span} %code requires { typedef struct { int l; int c; } Point; typedef struct { Point first; Point last; } Span; # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = YYRHSLOC (Rhs, 1).first; \ (Current).last = YYRHSLOC (Rhs, N).last; \ } \ else \ { \ (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \ } \ while (0) /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %initial-action { @$.first.l = @$.first.c = 1; @$.last = @$.first; } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } #include namespace { std::ostream& operator<< (std::ostream& o, const Span& s) { o << s.first.l << '.' << s.first.c; if (s.first.l != s.last.l) o << '-' << s.last.l << '.' << s.last.c - 1; else if (s.first.c != s.last.c - 1) o << '-' << s.last.c - 1; return o; } } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last.l++; (*llocp).last.c = 1; } else (*llocp).last.c++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first.c = (*llocp).last.c; (*llocp).first.l = (*llocp).last.l; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first.l, (*llocp).first.c); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1434" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1434" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1434" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1434: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1434" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1434" { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1434" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1434" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1434" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1434" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1434: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1434" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1434: cat stderr" at_fn_check_prepare_trace "calc.at:1434" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1434" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_526 #AT_START_527 at_fn_group_banner 527 'calc.at:1435' \ "Calculator C++ %header %locations parse.error=verbose %name-prefix \"calc\" %verbose " "" 19 at_xfail=no ( printf "%s\n" "527. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %header %locations %define parse.error verbose %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1435" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1435" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1435" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1435: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1435" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1435" { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1435" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1435" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1435" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1435" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1435" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1435: cat stderr" at_fn_check_prepare_trace "calc.at:1435" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1435" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_527 #AT_START_528 at_fn_group_banner 528 'calc.at:1437' \ "Calculator C++ %locations parse.error=verbose api.prefix={calc} %verbose " "" 19 at_xfail=no ( printf "%s\n" "528. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.error verbose %define api.prefix {calc} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1437" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1437" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1437" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1437" { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1437" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1437" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1437" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1437" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1437" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1437: cat stderr" at_fn_check_prepare_trace "calc.at:1437" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1437" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_528 #AT_START_529 at_fn_group_banner 529 'calc.at:1438' \ "Calculator C++ %locations parse.error=verbose %debug %name-prefix \"calc\" %verbose " "" 19 at_xfail=no ( printf "%s\n" "529. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1438" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1438" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1438" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1438" { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1438" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1438" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1438" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1438" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1438" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1438: cat stderr" at_fn_check_prepare_trace "calc.at:1438" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1438" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_529 #AT_START_530 at_fn_group_banner 530 'calc.at:1440' \ "Calculator C++ %locations parse.error=verbose %debug api.prefix={calc} %verbose " "" 19 at_xfail=no ( printf "%s\n" "530. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1440" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1440: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1440" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1440" { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1440" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1440" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1440" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1440" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1440: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1440" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1440: cat stderr" at_fn_check_prepare_trace "calc.at:1440" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1440" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_530 #AT_START_531 at_fn_group_banner 531 'calc.at:1441' \ "Calculator C++ %locations parse.error=verbose %debug api.prefix={calc} api.token.prefix={TOK_} %verbose " "" 19 at_xfail=no ( printf "%s\n" "531. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.error verbose %debug %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::TOK_NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::TOK_CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::TOK_CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1441" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1441" { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1441" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1441" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1441" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1441" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1441" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1441: cat stderr" at_fn_check_prepare_trace "calc.at:1441" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1441" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_531 #AT_START_532 at_fn_group_banner 532 'calc.at:1443' \ "Calculator C++ %header %locations parse.error=verbose %debug %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 19 at_xfail=no ( printf "%s\n" "532. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %header %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1443" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1443" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1443" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1443: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1443" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1443" { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1443" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1443" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1443" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1443" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1443: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1443" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1443: cat stderr" at_fn_check_prepare_trace "calc.at:1443" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1443" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_532 #AT_START_533 at_fn_group_banner 533 'calc.at:1445' \ "Calculator C++ parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 19 at_xfail=no ( printf "%s\n" "533. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1445" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1445" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1445" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1445" { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1445" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1445" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1445" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1445" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1445" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1445: cat stderr" at_fn_check_prepare_trace "calc.at:1445" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_533 #AT_START_534 at_fn_group_banner 534 'calc.at:1446' \ "Calculator C++ %header %locations parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 19 at_xfail=no ( printf "%s\n" "534. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %header %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1446" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1446" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1446" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1446: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1446" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1446" { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1446" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1446" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1446" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1446" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1446" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1446: cat stderr" at_fn_check_prepare_trace "calc.at:1446" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_534 #AT_START_535 at_fn_group_banner 535 'calc.at:1448' \ "Calculator C++ %header %locations api.location.file=none " "" 19 at_xfail=no ( printf "%s\n" "535. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %header %locations %define api.location.file none %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1448" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1448" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1448" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1448: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1448" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1448" { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1448" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1448" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1448" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1448" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1448: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1448" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1448: cat stderr" at_fn_check_prepare_trace "calc.at:1448" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1448" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_535 #AT_START_536 at_fn_group_banner 536 'calc.at:1449' \ "Calculator C++ %header %locations api.location.file=\"my-location.hh\" " "" 19 at_xfail=no ( printf "%s\n" "536. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %header %locations %define api.location.file "my-location.hh" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1449" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1449" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1449" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1449: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1449" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1449" { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1449" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1449" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1449" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1449" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1449: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1449" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1449: cat stderr" at_fn_check_prepare_trace "calc.at:1449" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1449" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_536 #AT_START_537 at_fn_group_banner 537 'calc.at:1451' \ "Calculator C++ %no-lines %header %locations api.location.file=\"my-location.hh\" " "" 19 at_xfail=no ( printf "%s\n" "537. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %no-lines %header %locations %define api.location.file "my-location.hh" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1451" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1451" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1451" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1451: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1451" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1451" { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1451" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1451" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1451" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1451" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1451: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1451" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1451: cat stderr" at_fn_check_prepare_trace "calc.at:1451" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1451" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_537 #AT_START_538 at_fn_group_banner 538 'calc.at:1453' \ "Calculator C++ %locations parse.lac=full parse.error=verbose " "" 19 at_xfail=no ( printf "%s\n" "538. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.lac full %define parse.error verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1453" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1453" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1453" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1453: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1453" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1453" { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1453" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1453" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1453" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1453" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1453: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1453" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1453: cat stderr" at_fn_check_prepare_trace "calc.at:1453" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1453" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_538 #AT_START_539 at_fn_group_banner 539 'calc.at:1454' \ "Calculator C++ %locations parse.lac=full parse.error=detailed " "" 19 at_xfail=no ( printf "%s\n" "539. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.lac full %define parse.error detailed %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1454" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1454" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1454" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1454: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1454" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1454" { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1454" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1454" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1454" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1454" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1454: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1454" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1454: cat stderr" at_fn_check_prepare_trace "calc.at:1454" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1454" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_539 #AT_START_540 at_fn_group_banner 540 'calc.at:1455' \ "Calculator C++ %locations parse.lac=full parse.error=detailed parse.trace " "" 19 at_xfail=no ( printf "%s\n" "540. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %locations %define parse.lac full %define parse.error detailed %define parse.trace %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1455" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1455" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1455" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1455: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1455" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1455" { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1455" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1455" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1017 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1455" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1455" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "80 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1455: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1455" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1455: cat stderr" at_fn_check_prepare_trace "calc.at:1455" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1455" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_540 #AT_START_541 at_fn_group_banner 541 'calc.at:1457' \ "Calculator C++ parse.error=custom " " " 19 at_xfail=no ( printf "%s\n" "541. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %define parse.error custom %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } void yy::parser::report_syntax_error (const context& ctx) const { std::cerr << "syntax error"; if (!ctx.lookahead ().empty ()) std::cerr << " on token [" << ctx.lookahead ().name () << ']'; { enum { TOKENMAX = 10 }; symbol_kind_type expected[TOKENMAX]; int n = ctx.expected_tokens (expected, TOKENMAX); if (0 < n) { std::cerr << " (expected:"; for (int i = 0; i < n; ++i) std::cerr << " [" << symbol_name (expected[i]) << ']'; std::cerr << ')'; } } std::cerr << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1457" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1457" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1457" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1457" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1457" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1457: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1457" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1457" { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1457" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1457" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1457" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1457" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1457" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1457: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1457: cat stderr" at_fn_check_prepare_trace "calc.at:1457" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1457" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_541 #AT_START_542 at_fn_group_banner 542 'calc.at:1458' \ "Calculator C++ parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 19 at_xfail=no ( printf "%s\n" "542. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } void calc::parser::report_syntax_error (const context& ctx) const { YY_USE (result); YY_USE (count); YY_USE (nerrs); ++global_nerrs; ++*nerrs; std::cerr << ctx.location () << ": "; std::cerr << "syntax error"; if (!ctx.lookahead ().empty ()) std::cerr << " on token [" << ctx.lookahead ().name () << ']'; { enum { TOKENMAX = 10 }; symbol_kind_type expected[TOKENMAX]; int n = ctx.expected_tokens (expected, TOKENMAX); if (0 < n) { std::cerr << " (expected:"; for (int i = 0; i < n; ++i) std::cerr << " [" << symbol_name (expected[i]) << ']'; std::cerr << ')'; } } std::cerr << '\n'; } #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1458" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1458" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1458" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1458" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1458" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1458: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1458" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1458" { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1458" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1458" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1458" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1458" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1458" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1458: cat stderr" at_fn_check_prepare_trace "calc.at:1458" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1458" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_542 #AT_START_543 at_fn_group_banner 543 'calc.at:1459' \ "Calculator C++ parse.error=custom %locations api.prefix={calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} parse.lac=full " "" 19 at_xfail=no ( printf "%s\n" "543. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %define parse.lac full %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } void calc::parser::report_syntax_error (const context& ctx) const { YY_USE (result); YY_USE (count); YY_USE (nerrs); ++global_nerrs; ++*nerrs; std::cerr << ctx.location () << ": "; std::cerr << "syntax error"; if (!ctx.lookahead ().empty ()) std::cerr << " on token [" << ctx.lookahead ().name () << ']'; { enum { TOKENMAX = 10 }; symbol_kind_type expected[TOKENMAX]; int n = ctx.expected_tokens (expected, TOKENMAX); if (0 < n) { std::cerr << " (expected:"; for (int i = 0; i < n; ++i) std::cerr << " [" << symbol_name (expected[i]) << ']'; std::cerr << ')'; } } std::cerr << '\n'; } #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1459" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1459" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1459" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1459" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1459" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1459: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1459" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1459" { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1459" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1459" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1459" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1459" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1459" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1459: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1459: cat stderr" at_fn_check_prepare_trace "calc.at:1459" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1459" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_543 #AT_START_544 at_fn_group_banner 544 'calc.at:1468' \ "Calculator glr.cc " " " 20 at_xfail=no ( printf "%s\n" "544. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr.cc" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1468" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1468" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1468" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1468: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1468" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1468" { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1468" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1468" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1468: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1468" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1468: cat stderr" at_fn_check_prepare_trace "calc.at:1468" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1468" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_544 #AT_START_545 at_fn_group_banner 545 'calc.at:1469' \ "Calculator glr2.cc " " " 20 at_xfail=no ( printf "%s\n" "545. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1469" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1469" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1469" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1469: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1469" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1469" printf "%s\n" "calc.at:1469" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1469" { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1469" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1469" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1469: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1469" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1469: cat stderr" at_fn_check_prepare_trace "calc.at:1469" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1469" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_545 #AT_START_546 at_fn_group_banner 546 'calc.at:1476' \ "Calculator C++ %glr-parser " " " 20 at_xfail=no ( printf "%s\n" "546. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1476" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1476" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1476" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1476: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1476" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1476" { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1476" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1476" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_546 #AT_START_547 at_fn_group_banner 547 'calc.at:1476' \ "Calculator glr2.cc " " " 20 at_xfail=no ( printf "%s\n" "547. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1476" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1476" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1476" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1476: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1476" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1476" printf "%s\n" "calc.at:1476" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1476" { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1476" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1476" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1476: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1476" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1476: cat stderr" at_fn_check_prepare_trace "calc.at:1476" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1476" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_547 #AT_START_548 at_fn_group_banner 548 'calc.at:1477' \ "Calculator C++ %glr-parser %locations " " " 20 at_xfail=no ( printf "%s\n" "548. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1477" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1477" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1477" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1477: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1477" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1477" { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1477" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1477" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_548 #AT_START_549 at_fn_group_banner 549 'calc.at:1477' \ "Calculator glr2.cc %locations " " " 20 at_xfail=no ( printf "%s\n" "549. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %locations %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1477" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1477" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1477" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1477: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1477" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1477" printf "%s\n" "calc.at:1477" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1477" { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1477" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1477" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1477: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1477" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1477: cat stderr" at_fn_check_prepare_trace "calc.at:1477" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1477" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_549 #AT_START_550 at_fn_group_banner 550 'calc.at:1478' \ "Calculator C++ %glr-parser %locations api.location.type={Span} " "" 20 at_xfail=no ( printf "%s\n" "550. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %locations %define api.location.type {Span} %code requires { typedef struct { int l; int c; } Point; typedef struct { Point first; Point last; } Span; # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = YYRHSLOC (Rhs, 1).first; \ (Current).last = YYRHSLOC (Rhs, N).last; \ } \ else \ { \ (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \ } \ while (0) /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %initial-action { @$.first.l = @$.first.c = 1; @$.last = @$.first; } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } #include namespace { std::ostream& operator<< (std::ostream& o, const Span& s) { o << s.first.l << '.' << s.first.c; if (s.first.l != s.last.l) o << '-' << s.last.l << '.' << s.last.c - 1; else if (s.first.c != s.last.c - 1) o << '-' << s.last.c - 1; return o; } } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last.l++; (*llocp).last.c = 1; } else (*llocp).last.c++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first.c = (*llocp).last.c; (*llocp).first.l = (*llocp).last.l; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first.l, (*llocp).first.c); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1478" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1478" { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1478" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1478" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_550 #AT_START_551 at_fn_group_banner 551 'calc.at:1478' \ "Calculator glr2.cc %locations api.location.type={Span} " "" 20 at_xfail=no ( printf "%s\n" "551. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %locations %define api.location.type {Span} %code requires { typedef struct { int l; int c; } Point; typedef struct { Point first; Point last; } Span; # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = YYRHSLOC (Rhs, 1).first; \ (Current).last = YYRHSLOC (Rhs, N).last; \ } \ else \ { \ (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \ } \ while (0) /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %initial-action { @$.first.l = @$.first.c = 1; @$.last = @$.first; } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } #include namespace { std::ostream& operator<< (std::ostream& o, const Span& s) { o << s.first.l << '.' << s.first.c; if (s.first.l != s.last.l) o << '-' << s.last.l << '.' << s.last.c - 1; else if (s.first.c != s.last.c - 1) o << '-' << s.last.c - 1; return o; } } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static yy::parser::location_type last_yylloc; static int get_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).last.l++; (*llocp).last.c = 1; } else (*llocp).last.c++; return res; } static void unget_char (yy::parser::value_type *lvalp, yy::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).first.c = (*llocp).last.c; (*llocp).first.l = (*llocp).last.l; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).first.l, (*llocp).first.c); fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1478" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1478: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1478" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1478" printf "%s\n" "calc.at:1478" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1478" { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1478" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1478" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1478: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1478" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1478: cat stderr" at_fn_check_prepare_trace "calc.at:1478" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1478" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_551 #AT_START_552 at_fn_group_banner 552 'calc.at:1479' \ "Calculator C++ %glr-parser %header parse.error=verbose %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "552. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %header %define parse.error verbose %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1479" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1479" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1479" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1479: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1479" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1479" { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1479" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1479" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_552 #AT_START_553 at_fn_group_banner 553 'calc.at:1479' \ "Calculator glr2.cc %header parse.error=verbose %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "553. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %header %define parse.error verbose %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1479" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1479" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1479" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1479: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1479" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1479" printf "%s\n" "calc.at:1479" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1479" { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1479" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1479" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1479: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1479" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1479: cat stderr" at_fn_check_prepare_trace "calc.at:1479" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1479" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_553 #AT_START_554 at_fn_group_banner 554 'calc.at:1480' \ "Calculator C++ %glr-parser parse.error=verbose api.prefix={calc} %verbose " "" 20 at_xfail=no ( printf "%s\n" "554. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %define parse.error verbose %define api.prefix {calc} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1480" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1480" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1480" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1480" { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1480" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1480" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_554 #AT_START_555 at_fn_group_banner 555 'calc.at:1480' \ "Calculator glr2.cc parse.error=verbose api.prefix={calc} %verbose " "" 20 at_xfail=no ( printf "%s\n" "555. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %define parse.error verbose %define api.prefix {calc} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1480" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1480" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1480: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1480" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1480" printf "%s\n" "calc.at:1480" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1480" { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1480" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1480" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1480: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1480" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1480: cat stderr" at_fn_check_prepare_trace "calc.at:1480" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1480" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_555 #AT_START_556 at_fn_group_banner 556 'calc.at:1482' \ "Calculator C++ %glr-parser %debug " " " 20 at_xfail=no ( printf "%s\n" "556. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %debug %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1482" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1482" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1482" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1482" { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1482" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1482" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_556 #AT_START_557 at_fn_group_banner 557 'calc.at:1482' \ "Calculator glr2.cc %debug " " " 20 at_xfail=no ( printf "%s\n" "557. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %debug %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int yylex (yy::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int yylex (yy::parser::value_type *lvalp); static int get_char (yy::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (yy::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (yy::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int yylex (yy::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return yy::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return yy::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return yy::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ yyparse that simulates the C signature. */ int yyparse () { yy::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = yyparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1482" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1482" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1482" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1482" printf "%s\n" "calc.at:1482" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1482" { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1482" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1482" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1482: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1482" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1482: cat stderr" at_fn_check_prepare_trace "calc.at:1482" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1482" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_557 #AT_START_558 at_fn_group_banner 558 'calc.at:1485' \ "Calculator C++ %glr-parser parse.error=detailed %debug %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "558. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %define parse.error detailed %debug %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1485" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1485" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1485" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1485: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1485" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1485" { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1485" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1485" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_558 #AT_START_559 at_fn_group_banner 559 'calc.at:1485' \ "Calculator glr2.cc parse.error=detailed %debug %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "559. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %define parse.error detailed %debug %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1485" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1485" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1485" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1485: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1485" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1485" printf "%s\n" "calc.at:1485" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1485" { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1485" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1485" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1485: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1485" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1485: cat stderr" at_fn_check_prepare_trace "calc.at:1485" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1485" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_559 #AT_START_560 at_fn_group_banner 560 'calc.at:1486' \ "Calculator C++ %glr-parser parse.error=verbose %debug %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "560. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1486" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1486" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1486" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1486" { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1486" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1486" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_560 #AT_START_561 at_fn_group_banner 561 'calc.at:1486' \ "Calculator glr2.cc parse.error=verbose %debug %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "561. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %define parse.error verbose %debug %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1486" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1486" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1486: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1486" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1486" printf "%s\n" "calc.at:1486" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1486" { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1486" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1486" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1486: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1486" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1486: cat stderr" at_fn_check_prepare_trace "calc.at:1486" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1486" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_561 #AT_START_562 at_fn_group_banner 562 'calc.at:1487' \ "Calculator glr2.cc parse.error=custom %debug %name-prefix \"calc\" %verbose " "" 20 at_xfail=no ( printf "%s\n" "562. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %define parse.error custom %debug %name-prefix "calc" %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); #define N_ static const char * _ (const char *cp) { if (strcmp (cp, "end of input") == 0) return "end of file"; else if (strcmp (cp, "number") == 0) return "nombre"; else return cp; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } void calc::parser::report_syntax_error (const context& ctx) const { std::cerr << "syntax error"; if (!ctx.lookahead ().empty ()) std::cerr << " on token [" << ctx.lookahead ().name () << ']'; { enum { TOKENMAX = 10 }; symbol_kind_type expected[TOKENMAX]; int n = ctx.expected_tokens (expected, TOKENMAX); if (0 < n) { std::cerr << " (expected:"; for (int i = 0; i < n; ++i) std::cerr << " [" << symbol_name (expected[i]) << ']'; std::cerr << ')'; } } std::cerr << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1487" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1487" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1487" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1487: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1487" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1487: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1487" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1487: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1487" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1487" printf "%s\n" "calc.at:1487" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1487" { set +x printf "%s\n" "$at_srcdir/calc.at:1487: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1487" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1487: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1487" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1487" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1487: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1487: cat stderr" at_fn_check_prepare_trace "calc.at:1487" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1487" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_562 #AT_START_563 at_fn_group_banner 563 'calc.at:1489' \ "Calculator C++ %glr-parser parse.error=verbose %debug %name-prefix \"calc\" api.token.prefix={TOK_} %verbose " "" 20 at_xfail=no ( printf "%s\n" "563. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::TOK_NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::TOK_CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::TOK_YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1489" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1489" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1489" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1489" { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1489" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1489" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_563 #AT_START_564 at_fn_group_banner 564 'calc.at:1489' \ "Calculator glr2.cc parse.error=verbose %debug %name-prefix \"calc\" api.token.prefix={TOK_} %verbose " "" 20 at_xfail=no ( printf "%s\n" "564. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: '\n' | exp '\n' { USE ($1); } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error ("error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include int calclex (calc::parser::value_type *lvalp); static int get_char (calc::parser::value_type *lvalp) { int res = getc (input); (void) lvalp;; return res; } static void unget_char (calc::parser::value_type *lvalp, int c) { (void) lvalp;; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp) { int c = get_char (lvalp); int res = 0; (void) lvalp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp); } unget_char (lvalp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp) { int c; /* Skip white spaces. */ do { } while ((c = get_char (lvalp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, c); (*lvalp).ival = read_integer (lvalp); return calc::parser::token::TOK_NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::TOK_CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::TOK_YYerror; } /* Return single chars. */ return c; } #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse () { calc::parser parser; #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (); } if (input != stdin && fclose (input)) perror ("fclose"); } } return status; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1489" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1489" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1489" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1489" printf "%s\n" "calc.at:1489" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1489" { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS" "calc.at:1489" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1489" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1489" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1489: cat stderr" at_fn_check_prepare_trace "calc.at:1489" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1489" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_564 #AT_START_565 at_fn_group_banner 565 'calc.at:1491' \ "Calculator C++ %glr-parser %locations %header parse.error=verbose %debug %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 20 at_xfail=no ( printf "%s\n" "565. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %locations %header %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1491" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1491" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1491" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1491: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1491" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1491" { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1491" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1491" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_565 #AT_START_566 at_fn_group_banner 566 'calc.at:1491' \ "Calculator glr2.cc %locations %header parse.error=verbose %debug %name-prefix \"calc\" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 20 at_xfail=no ( printf "%s\n" "566. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %locations %header %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::YYerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if YYDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1491" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1491" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1491" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1491: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1491" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1491" printf "%s\n" "calc.at:1491" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1491" { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1491" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1491" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1491: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1491" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1491: cat stderr" at_fn_check_prepare_trace "calc.at:1491" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1491" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_566 #AT_START_567 at_fn_group_banner 567 'calc.at:1492' \ "Calculator C++ %glr-parser %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 20 at_xfail=no ( printf "%s\n" "567. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1492" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1492" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1492" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1492: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1492" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1492" { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1492" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1492" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_567 #AT_START_568 at_fn_group_banner 568 'calc.at:1492' \ "Calculator glr2.cc %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 20 at_xfail=no ( printf "%s\n" "568. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1492" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1492" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1492" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1492: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1492" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1492" printf "%s\n" "calc.at:1492" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1492" { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1492" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1492" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1492: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1492" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1492: cat stderr" at_fn_check_prepare_trace "calc.at:1492" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1492" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_568 #AT_START_569 at_fn_group_banner 569 'calc.at:1494' \ "Calculator C++ %glr-parser %no-lines %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 20 at_xfail=no ( printf "%s\n" "569. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %language "C++" %glr-parser %no-lines %locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1494" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1494" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1494" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1494" { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1494" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1494" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_569 #AT_START_570 at_fn_group_banner 570 'calc.at:1494' \ "Calculator glr2.cc %no-lines %locations %header parse.error=verbose %debug api.prefix={calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} " "" 20 at_xfail=no ( printf "%s\n" "570. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y.tmp <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Infix notation calculator--calc */ %skeleton "glr2.cc" %no-lines %locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs} %code requires { /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo << $$; } ; %code provides { #include /* The input. */ extern FILE *input; /* Whether \n is a blank. */ extern int ignore_eol; extern semantic_value global_result; extern int global_count; extern int global_nerrs; } %code { #include #include #define USE(Var) FILE *input; int ignore_eol = 0; static int power (int base, int exponent); int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line { ++*count; ++global_count; } ; line: '\n' | exp '\n' { *result = global_result = $1; } ; exp: NUM | exp '=' exp { if ($1 != $3) { char buf[1024]; snprintf (buf, sizeof buf, "error: %d != %d", $1, $3); yyparser.error (@$, buf); } $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3 == 0) { yyparser.error (@3, "error: null divisor"); } else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = power ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; yyerrok; } | '-' error { $$ = 0; YYERROR; } | '!' '!' { $$ = 0; YYERROR; } | '!' '+' { $$ = 0; YYACCEPT; } | '!' '-' { $$ = 0; YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } /* A C++ error reporting function. */ void calc::parser::error (const location_type& l, const std::string& m) { ++global_nerrs; ++*nerrs; std::cerr << l << ": " << m << '\n'; } _ATEOF # Remove the generated prototypes. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: mv calc.y.tmp calc.y " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; mv calc.y.tmp calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >calc-lex.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp); static calc::parser::location_type last_yylloc; static int get_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int res = getc (input); (void) lvalp;(void) llocp;; last_yylloc = (*llocp); if (res == '\n') { (*llocp).end.line++; (*llocp).end.column = 1; } else (*llocp).end.column++; return res; } static void unget_char (calc::parser::value_type *lvalp, calc::parser::location_type *llocp, int c) { (void) lvalp;(void) llocp;; /* Wrong when C == '\n'. */ (*llocp) = last_yylloc; ungetc (c, input); } static int read_integer (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c = get_char (lvalp, llocp); int res = 0; (void) lvalp;(void) llocp;; while (isdigit (c)) { res = 10 * res + (c - '0'); c = get_char (lvalp, llocp); } unget_char (lvalp, llocp, c); return res; } /*---------------------------------------------------------------. | Lexical analyzer returns an integer on the stack and the token | | NUM, or the ASCII character read if not a number. Skips all | | blanks and tabs, returns 0 for EOF. | `---------------------------------------------------------------*/ int calclex (calc::parser::value_type *lvalp, calc::parser::location_type *llocp) { int c; /* Skip white spaces. */ do { (*llocp).begin.column = (*llocp).end.column; (*llocp).begin.line = (*llocp).end.line; } while ((c = get_char (lvalp, llocp)) == ' ' || c == '\t' || (ignore_eol && c == '\n')); /* Process numbers. */ if (isdigit (c)) { unget_char (lvalp, llocp, c); (*lvalp).ival = read_integer (lvalp, llocp); return calc::parser::token::NUM; } /* Return end-of-file. */ if (c == EOF) return calc::parser::token::CALC_EOF; /* An explicit error raised by the scanner. */ if (c == '#') { fprintf (stderr, "%d.%d: ", (*llocp).begin.line, (*llocp).begin.column); fputs ("syntax error: invalid character: '#'\n", stderr); return calc::parser::token::CALCerror; } /* Return single chars. */ return c; } _ATEOF cat >calc-main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "calc.hh" #include #include /* exit */ #include /* strcmp */ #include namespace { /* A C++ calcparse that simulates the C signature. */ int calcparse (semantic_value *result, int *count, int *nerrs) { calc::parser parser (result, count, nerrs); #if CALCDEBUG parser.set_debug_level (1); #endif return parser.parse (); } } /* Value of the last computation. */ semantic_value global_result = 0; /* Total number of computations. */ int global_count = 0; /* Total number of errors. */ int global_nerrs = 0; #ifndef EX_NOINPUT # define EX_NOINPUT 66 #endif static FILE * open_file (const char *file) { FILE *res = (file && *file && strcmp (file, "-")) ? fopen (file, "r") : stdin; if (!res) { perror (file); exit (EX_NOINPUT); } return res; } /* A C main function. */ int main (int argc, const char **argv) { semantic_value result = 0; int count = 0; int nerrs = 0; int status = 0; /* This used to be alarm (10), but that isn't enough time for a July 1995 vintage DEC Alphastation 200 4/100 system, according to Nelson H. F. Beebe. 100 seconds was enough for regular users, but the Hydra build farm, which is heavily loaded needs more. */ alarm (200); { int i; for (i = 1; i < argc; ++i) { { input = open_file (argv[i]); status = calcparse (&result, &count, &nerrs); } if (input != stdin && fclose (input)) perror ("fclose"); } } assert (global_result == result); (void) result; assert (global_count == count); (void) count; assert (global_nerrs == nerrs); (void) nerrs; printf ("final: %d %d %d\n", global_result, global_count, global_nerrs); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y" "calc.at:1494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1494" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1494" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.cc calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1494" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1494" printf "%s\n" "calc.at:1494" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1494" { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS" "calc.at:1494" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o calc calc.cc calc-lex.cc calc-main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.cc calc.hh " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.cc calc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 64 12 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1494" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 4444 0 5 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 3333 0 3 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 0 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2222 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 1111 0 0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "final: 2 0 1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1494: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1494" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1494: cat stderr" at_fn_check_prepare_trace "calc.at:1494" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1494" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_570 #AT_START_571 at_fn_group_banner 571 'calc.at:1504' \ "Calculator lalr1.d " " " 21 at_xfail=no ( printf "%s\n" "571. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %skeleton "lalr1.d" %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { } /* Bison Declarations */ %token EOF 0 "end of input" %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1504" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1504" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1504" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1504: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1504" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1504" { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1504" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1504" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1504" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1504: cat stderr" at_fn_check_prepare_trace "calc.at:1504" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1504" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_571 #AT_START_572 at_fn_group_banner 572 'calc.at:1509' \ "Calculator D " " " 21 at_xfail=no ( printf "%s\n" "572. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { } /* Bison Declarations */ %token EOF 0 "end of input" %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1509" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1509" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1509" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1509" { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1509" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1509" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1509: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1509" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1509: cat stderr" at_fn_check_prepare_trace "calc.at:1509" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1509" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_572 #AT_START_573 at_fn_group_banner 573 'calc.at:1510' \ "Calculator D %locations " " " 21 at_xfail=no ( printf "%s\n" "573. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { } /* Bison Declarations */ %token EOF 0 "end of input" %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1510" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1510" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1510" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1510: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1510" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1510" { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1510" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1510" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1510: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1510" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1510: cat stderr" at_fn_check_prepare_trace "calc.at:1510" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1510" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_573 #AT_START_574 at_fn_group_banner 574 'calc.at:1512' \ "Calculator D parse.error=detailed api.prefix={calc} %verbose " "" 21 at_xfail=no ( printf "%s\n" "574. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define parse.error detailed %define api.prefix {calc} %verbose %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1512" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1512" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1512" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1512: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1512" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1512" { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1512" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1512" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1512: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1512" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1512: cat stderr" at_fn_check_prepare_trace "calc.at:1512" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1512" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_574 #AT_START_575 at_fn_group_banner 575 'calc.at:1514' \ "Calculator D %debug " " " 21 at_xfail=no ( printf "%s\n" "575. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %debug %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { } /* Bison Declarations */ %token EOF 0 "end of input" %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); p.setDebugLevel (1); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1514" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1514" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1514" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1514: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1514" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1514" { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1514" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1514" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1514: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1514" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1514: cat stderr" at_fn_check_prepare_trace "calc.at:1514" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1514" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_575 #AT_START_576 at_fn_group_banner 576 'calc.at:1516' \ "Calculator D parse.error=custom " " " 21 at_xfail=no ( printf "%s\n" "576. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define parse.error custom %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } // In the case of D, there are no single quotes around the symbols // so they need to be added here public string transformToken(YYParser.SymbolKind token) { string res; foreach (i; format("%s", token)) { if (i == '\"') res ~= '\''; else res ~= i; } if (res.length == 1) return '\'' ~ res ~ '\''; else return res; } public void reportSyntaxError(YYParser.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. string msg; msg ~= "syntax error"; { YYParser.SymbolKind token = ctx.getToken(); msg ~= " on token [" ~ transformToken(token) ~ "]"; } { immutable int argmax = 7; YYParser.SymbolKind[] arg = new YYParser.SymbolKind[argmax]; int n = ctx.getExpectedTokens(arg, argmax); if (0 < n) { msg ~= " (expected:"; for (int i = 0; i < n; ++i) msg ~= " [" ~ transformToken(arg[i]) ~ "]"; msg ~= ")"; } } stderr.writeln(msg); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1516" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1516" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1516: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1516" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1516: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1516" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1516: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1516" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1516" { set +x printf "%s\n" "$at_srcdir/calc.at:1516: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1516" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1516: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1516" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1516" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1516: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1516: cat stderr" at_fn_check_prepare_trace "calc.at:1516" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1516" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_576 #AT_START_577 at_fn_group_banner 577 'calc.at:1517' \ "Calculator D %locations parse.error=custom " " " 21 at_xfail=no ( printf "%s\n" "577. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %define parse.error custom %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } // In the case of D, there are no single quotes around the symbols // so they need to be added here public string transformToken(YYParser.SymbolKind token) { string res; foreach (i; format("%s", token)) { if (i == '\"') res ~= '\''; else res ~= i; } if (res.length == 1) return '\'' ~ res ~ '\''; else return res; } public void reportSyntaxError(YYParser.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. string msg; msg ~= ctx.getLocation().toString() ~ ": " ~ "syntax error"; { YYParser.SymbolKind token = ctx.getToken(); msg ~= " on token [" ~ transformToken(token) ~ "]"; } { immutable int argmax = 7; YYParser.SymbolKind[] arg = new YYParser.SymbolKind[argmax]; int n = ctx.getExpectedTokens(arg, argmax); if (0 < n) { msg ~= " (expected:"; for (int i = 0; i < n; ++i) msg ~= " [" ~ transformToken(arg[i]) ~ "]"; msg ~= ")"; } } stderr.writeln(msg); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1517" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1517" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1517: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1517" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1517: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1517" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1517: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1517" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1517" { set +x printf "%s\n" "$at_srcdir/calc.at:1517: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1517" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1517: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1517" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1517" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1517: cat stderr" at_fn_check_prepare_trace "calc.at:1517" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1517" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_577 #AT_START_578 at_fn_group_banner 578 'calc.at:1518' \ "Calculator D %locations parse.error=detailed " " " 21 at_xfail=no ( printf "%s\n" "578. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %define parse.error detailed %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1518" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1518" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1518" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1518: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1518" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1518" { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1518" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1518" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1518: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1518" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1518: cat stderr" at_fn_check_prepare_trace "calc.at:1518" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1518" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_578 #AT_START_579 at_fn_group_banner 579 'calc.at:1519' \ "Calculator D %locations parse.error=simple " " " 21 at_xfail=no ( printf "%s\n" "579. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %define parse.error simple %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { } /* Bison Declarations */ %token EOF 0 "end of input" %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1519" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1519" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1519" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1519: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1519" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1519" { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1519" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1519" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1519: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1519" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1519: cat stderr" at_fn_check_prepare_trace "calc.at:1519" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1519" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_579 #AT_START_580 at_fn_group_banner 580 'calc.at:1520' \ "Calculator D parse.error=detailed %debug %verbose " "" 21 at_xfail=no ( printf "%s\n" "580. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define parse.error detailed %debug %verbose %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); p.setDebugLevel (1); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1520" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1520" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1520" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1520: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1520" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1520" { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1520" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1520" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1520: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1520" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1520: cat stderr" at_fn_check_prepare_trace "calc.at:1520" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1520" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_580 #AT_START_581 at_fn_group_banner 581 'calc.at:1521' \ "Calculator D parse.error=detailed %debug api.symbol.prefix={SYMB_} api.token.prefix={TOK_} %verbose " "" 21 at_xfail=no ( printf "%s\n" "581. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define parse.error detailed %debug %define api.symbol.prefix {SYMB_} %define api.token.prefix {TOK_} %verbose %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.TOK_EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.TOK_NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.TOK_YYerror); } switch (c) { case '+': return Symbol(TokenKind.TOK_PLUS); case '-': return Symbol(TokenKind.TOK_MINUS); case '*': return Symbol(TokenKind.TOK_STAR); case '/': return Symbol(TokenKind.TOK_SLASH); case '(': return Symbol(TokenKind.TOK_LPAR); case ')': return Symbol(TokenKind.TOK_RPAR); case '\n': return Symbol(TokenKind.TOK_EOL); case '=': return Symbol(TokenKind.TOK_EQUAL); case '^': return Symbol(TokenKind.TOK_POW); case '!': return Symbol(TokenKind.TOK_NOT); default: return Symbol(TokenKind.TOK_YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); p.setDebugLevel (1); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1521" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1521" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1521" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1521: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1521" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1521" { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1521" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1521" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1521: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1521" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1521: cat stderr" at_fn_check_prepare_trace "calc.at:1521" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1521" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_581 #AT_START_582 at_fn_group_banner 582 'calc.at:1523' \ "Calculator D %locations parse.lac=full parse.error=detailed " "" 21 at_xfail=no ( printf "%s\n" "582. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %define parse.lac full %define parse.error detailed %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1523" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1523" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1523" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1523" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1523" { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1523" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1523" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1523: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1523" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1523: cat stderr" at_fn_check_prepare_trace "calc.at:1523" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1523" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_582 #AT_START_583 at_fn_group_banner 583 'calc.at:1524' \ "Calculator D %locations parse.lac=full parse.error=custom " "" 21 at_xfail=no ( printf "%s\n" "583. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %define parse.lac full %define parse.error custom %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } // In the case of D, there are no single quotes around the symbols // so they need to be added here public string transformToken(YYParser.SymbolKind token) { string res; foreach (i; format("%s", token)) { if (i == '\"') res ~= '\''; else res ~= i; } if (res.length == 1) return '\'' ~ res ~ '\''; else return res; } public void reportSyntaxError(YYParser.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. string msg; msg ~= ctx.getLocation().toString() ~ ": " ~ "syntax error"; { YYParser.SymbolKind token = ctx.getToken(); msg ~= " on token [" ~ transformToken(token) ~ "]"; } { immutable int argmax = 7; YYParser.SymbolKind[] arg = new YYParser.SymbolKind[argmax]; int n = ctx.getExpectedTokens(arg, argmax); if (0 < n) { msg ~= " (expected:"; for (int i = 0; i < n; ++i) msg ~= " [" ~ transformToken(arg[i]) ~ "]"; msg ~= ")"; } } stderr.writeln(msg); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1524" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1524" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1524: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1524" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1524: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1524" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1524: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1524" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1524" { set +x printf "%s\n" "$at_srcdir/calc.at:1524: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1524" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1524: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1524" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1524" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1524: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1524: cat stderr" at_fn_check_prepare_trace "calc.at:1524" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1524" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_583 #AT_START_584 at_fn_group_banner 584 'calc.at:1525' \ "Calculator D %locations parse.lac=full parse.error=detailed parse.trace " "" 21 at_xfail=no ( printf "%s\n" "584. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %locations %define parse.lac full %define parse.error detailed %define parse.trace %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); p.setDebugLevel (1); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1525" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1525" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1525" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1525: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1525" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1525" { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1525" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1525" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1525: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1525" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1525: cat stderr" at_fn_check_prepare_trace "calc.at:1525" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1525" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_584 #AT_START_585 at_fn_group_banner 585 'calc.at:1530' \ "Calculator D api.token.constructor %locations parse.error=custom api.value.type=union " "" 21 at_xfail=no ( printf "%s\n" "585. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define api.token.constructor %locations %define parse.error custom %define api.value.type union %code imports { alias semantic_value = int; } /* Exercise %union. */ %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } // In the case of D, there are no single quotes around the symbols // so they need to be added here public string transformToken(YYParser.SymbolKind token) { string res; foreach (i; format("%s", token)) { if (i == '\"') res ~= '\''; else res ~= i; } if (res.length == 1) return '\'' ~ res ~ '\''; else return res; } public void reportSyntaxError(YYParser.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. string msg; msg ~= ctx.getLocation().toString() ~ ": " ~ "syntax error"; { YYParser.SymbolKind token = ctx.getToken(); msg ~= " on token [" ~ transformToken(token) ~ "]"; } { immutable int argmax = 7; YYParser.SymbolKind[] arg = new YYParser.SymbolKind[argmax]; int n = ctx.getExpectedTokens(arg, argmax); if (0 < n) { msg ~= " (expected:"; for (int i = 0; i < n; ++i) msg ~= " [" ~ transformToken(arg[i]) ~ "]"; msg ~= ")"; } } stderr.writeln(msg); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol.EOF(location); // Numbers. if (input.front.isNumber) return Symbol.NUM(parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol.YYerror(location); } switch (c) { case '+': return Symbol.PLUS(location); case '-': return Symbol.MINUS(location); case '*': return Symbol.STAR(location); case '/': return Symbol.SLASH(location); case '(': return Symbol.LPAR(location); case ')': return Symbol.RPAR(location); case '\n': return Symbol.EOL(location); case '=': return Symbol.EQUAL(location); case '^': return Symbol.POW(location); case '!': return Symbol.NOT(location); default: return Symbol.YYUNDEF(location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1530" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1530" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1530: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1530" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1530: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1530" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1530: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1530" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1530" { set +x printf "%s\n" "$at_srcdir/calc.at:1530: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1530" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1530: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1530" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1530" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1530: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1530: cat stderr" at_fn_check_prepare_trace "calc.at:1530" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1530" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_585 #AT_START_586 at_fn_group_banner 586 'calc.at:1531' \ "Calculator D api.token.constructor %locations parse.error=detailed " "" 21 at_xfail=no ( printf "%s\n" "586. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define api.token.constructor %locations %define parse.error detailed %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol.EOF(location); // Numbers. if (input.front.isNumber) return Symbol.NUM(parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol.YYerror(location); } switch (c) { case '+': return Symbol.PLUS(location); case '-': return Symbol.MINUS(location); case '*': return Symbol.STAR(location); case '/': return Symbol.SLASH(location); case '(': return Symbol.LPAR(location); case ')': return Symbol.RPAR(location); case '\n': return Symbol.EOL(location); case '=': return Symbol.EQUAL(location); case '^': return Symbol.POW(location); case '!': return Symbol.NOT(location); default: return Symbol.YYUNDEF(location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1531" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1531" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1531: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1531" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1531" { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1531" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1531" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1531: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1531" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1531: cat stderr" at_fn_check_prepare_trace "calc.at:1531" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1531" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_586 #AT_START_587 at_fn_group_banner 587 'calc.at:1532' \ "Calculator D api.push-pull=both " " " 21 at_xfail=no ( printf "%s\n" "587. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define api.push-pull both %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { } /* Bison Declarations */ %token EOF 0 "end of input" %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (string m) { stderr.writeln (m); } int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); input.popFront; } return res; } Symbol yylex () { import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; } // EOF. if (input.empty) return Symbol(TokenKind.EOF); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt); // Individual characters auto c = input.front; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln ("syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror); } switch (c) { case '+': return Symbol(TokenKind.PLUS); case '-': return Symbol(TokenKind.MINUS); case '*': return Symbol(TokenKind.STAR); case '/': return Symbol(TokenKind.SLASH); case '(': return Symbol(TokenKind.LPAR); case ')': return Symbol(TokenKind.RPAR); case '\n': return Symbol(TokenKind.EOL); case '=': return Symbol(TokenKind.EQUAL); case '^': return Symbol(TokenKind.POW); case '!': return Symbol(TokenKind.NOT); default: return Symbol(TokenKind.YYUNDEF); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1532" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1532" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1532" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1532: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1532" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1532" { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1532" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1532" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1532: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; # In the case of D, there are no single quotes around the symbols. \$unexp =~ s/'\"'(.)'\"'/\$1/g; s/'\"'(.)'\"'/\$1/g for @exps; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1532" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; # In the case of D, there are no single quotes around the symbols. $unexp =~ s/'"'(.)'"'/$1/g; s/'"'(.)'"'/$1/g for @exps; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1532: cat stderr" at_fn_check_prepare_trace "calc.at:1532" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1532" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_587 #AT_START_588 at_fn_group_banner 588 'calc.at:1533' \ "Calculator D parse.trace parse.error=custom %locations api.push-pull=both parse.lac=full " "" 21 at_xfail=no ( printf "%s\n" "588. $at_setup_line: testing $at_desc ..." $at_traceon cat >calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %language "D" %define parse.trace %define parse.error custom %locations %define api.push-pull both %define parse.lac full %code imports { alias semantic_value = int; } /* Exercise %union. */ %union { semantic_value ival; }; %printer { yyo.write($$); } ; %code { static string _(string s) { switch (s) { case "end of input": return "end of file"; case "number": return "nombre"; default: return s; } } } /* Bison Declarations */ %token EOF 0 _("end of file") %token NUM "number" %type exp %token EQUAL "=" MINUS "-" PLUS "+" STAR "*" SLASH "/" POW "^" EOL "'\\n'" LPAR "(" RPAR ")" NOT "!" %nonassoc "=" /* comparison */ %left "-" "+" %left "*" "/" %precedence NEG /* negation--unary minus */ %right "^" /* exponentiation */ /* Grammar follows */ %% input: line | input line { } ; line: EOL | exp EOL { } ; exp: NUM | exp "=" exp { if ($1 != $3) yyerror (@$, format ("error: %d != %d", $1, $3)); $$ = $1; } | exp "+" exp { $$ = $1 + $3; } | exp "-" exp { $$ = $1 - $3; } | exp "*" exp { $$ = $1 * $3; } | exp "/" exp { if ($3 == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | "-" exp %prec NEG { $$ = -$2; } | exp "^" exp { $$ = power ($1, $3); } | "(" exp ")" { $$ = $2; } | "(" error ")" { $$ = 1111; yyerrok(); } | "-" error { $$ = 0; return YYERROR; } | "!" "!" { $$ = 0; return YYERROR; } | "!" "+" { $$ = 0; return YYACCEPT; } | "!" "-" { $$ = 0; return YYABORT; } ; %% int power (int base, int exponent) { int res = 1; assert (0 <= exponent); for (/* Niente */; exponent; --exponent) res *= base; return res; } import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } /* An error reporting function. */ public void yyerror (const YYLocation l, string m) { stderr.writeln (l, ": ", m); } // In the case of D, there are no single quotes around the symbols // so they need to be added here public string transformToken(YYParser.SymbolKind token) { string res; foreach (i; format("%s", token)) { if (i == '\"') res ~= '\''; else res ~= i; } if (res.length == 1) return '\'' ~ res ~ '\''; else return res; } public void reportSyntaxError(YYParser.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. string msg; msg ~= ctx.getLocation().toString() ~ ": " ~ "syntax error"; { YYParser.SymbolKind token = ctx.getToken(); msg ~= " on token [" ~ transformToken(token) ~ "]"; } { immutable int argmax = 7; YYParser.SymbolKind[] arg = new YYParser.SymbolKind[argmax]; int n = ctx.getExpectedTokens(arg, argmax); if (0 < n) { msg ~= " (expected:"; for (int i = 0; i < n; ++i) msg ~= " [" ~ transformToken(arg[i]) ~ "]"; msg ~= ")"; } } stderr.writeln(msg); } Location location; int parseInt () { auto res = 0; import std.uni : isNumber; while (input.front.isNumber) { res = res * 10 + (input.front - '0'); location.end.column += 1; input.popFront; } return res; } Symbol yylex () { location.step(); import std.uni : isWhite, isNumber; // Skip initial spaces while (!input.empty && input.front != '\n' && isWhite (input.front)) { input.popFront; location.end.column += 1; } location.step(); // EOF. if (input.empty) return Symbol(TokenKind.EOF, location); // Numbers. if (input.front.isNumber) return Symbol(TokenKind.NUM, parseInt, location); // Individual characters auto c = input.front; if (c == '\n') { location.end.line += 1; location.end.column = 1; } else location.end.column += 1; input.popFront; // An explicit error raised by the scanner. */ if (c == '#') { stderr.writeln (location, ": ", "syntax error: invalid character: '#'"); return Symbol(TokenKind.YYerror, location); } switch (c) { case '+': return Symbol(TokenKind.PLUS, location); case '-': return Symbol(TokenKind.MINUS, location); case '*': return Symbol(TokenKind.STAR, location); case '/': return Symbol(TokenKind.SLASH, location); case '(': return Symbol(TokenKind.LPAR, location); case ')': return Symbol(TokenKind.RPAR, location); case '\n': return Symbol(TokenKind.EOL, location); case '=': return Symbol(TokenKind.EQUAL, location); case '^': return Symbol(TokenKind.POW, location); case '!': return Symbol(TokenKind.NOT, location); default: return Symbol(TokenKind.YYUNDEF, location); } } } int main (string[] args) { File input = args.length == 2 ? File (args[1], "r") : stdin; auto l = calcLexer (input); auto p = new YYParser (l); p.setDebugLevel (1); return !p.parse(); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1533" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y" "calc.at:1533" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1533: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1533" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1533: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1533" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1533: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o calc.d calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1533" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1533" { set +x printf "%s\n" "$at_srcdir/calc.at:1533: \$DC \$DCFLAGS -ofcalc calc.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofcalc calc.d" "calc.at:1533" ( $at_check_trace; $DC $DCFLAGS -ofcalc calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1533: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' calc.d " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1533" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' calc.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: \$PREPARSER ./calc /dev/null" at_fn_check_prepare_dynamic " $PREPARSER ./calc /dev/null" "calc.at:1533" ( $at_check_trace; $PREPARSER ./calc /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-46: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-16: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1533: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-17: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1533: cat stderr" at_fn_check_prepare_trace "calc.at:1533" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1533" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_588 #AT_START_589 at_fn_group_banner 589 'calc.at:1544' \ "Calculator Java " " " 22 at_xfail=no ( printf "%s\n" "589. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %code imports { import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror ("error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } public void yyerror (String m) { System.err.println (m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; int tkind = st.nextToken(); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println("syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1544: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1544" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1544" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1544" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1544: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1544" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1544" printf "%s\n" "calc.at:1544" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1544" { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1544" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1544" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1544" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1544" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1544" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1544: cat stderr" at_fn_check_prepare_trace "calc.at:1544" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1544" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_589 #AT_START_590 at_fn_group_banner 590 'calc.at:1545' \ "Calculator Java parse.error=custom " " " 22 at_xfail=no ( printf "%s\n" "590. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.error custom %code imports { import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror ("error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } public void yyerror (String m) { System.err.println (m); } public void reportSyntaxError(Calc.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. String msg = "syntax error"; { Calc.SymbolKind token = ctx.getToken(); if (token != null) msg += " on token [" + token.getName() + "]"; } { Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS]; int n = ctx.getExpectedTokens(arg, ctx.NTOKENS); if (0 < n) { msg += " (expected:"; for (int i = 0; i < n; ++i) msg += " [" + arg[i].getName() + "]"; msg += ")"; } } System.err.println(msg); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; int tkind = st.nextToken(); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println("syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1545" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1545: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1545" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1545" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1545" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1545: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1545" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1545" printf "%s\n" "calc.at:1545" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1545" { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1545" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1545" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1545" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1545" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1545: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1545" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1545: cat stderr" at_fn_check_prepare_trace "calc.at:1545" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1545" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_590 #AT_START_591 at_fn_group_banner 591 'calc.at:1546' \ "Calculator Java parse.error=detailed " " " 22 at_xfail=no ( printf "%s\n" "591. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.error detailed %code imports { import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror ("error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } public void yyerror (String m) { System.err.println (m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; int tkind = st.nextToken(); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println("syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1546: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1546" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1546" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1546" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1546: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1546" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1546" printf "%s\n" "calc.at:1546" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1546" { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1546" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1546" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1546" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1546" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1546" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1546: cat stderr" at_fn_check_prepare_trace "calc.at:1546" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1546" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_591 #AT_START_592 at_fn_group_banner 592 'calc.at:1547' \ "Calculator Java parse.error=verbose " " " 22 at_xfail=no ( printf "%s\n" "592. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.error verbose %code imports { import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror ("error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } public void yyerror (String m) { System.err.println (m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; int tkind = st.nextToken(); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println("syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1547: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1547" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1547" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1547" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1547: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1547" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1547" printf "%s\n" "calc.at:1547" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1547" { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1547" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1547" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1547" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1547" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1547" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1547: cat stderr" at_fn_check_prepare_trace "calc.at:1547" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1547" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_592 #AT_START_593 at_fn_group_banner 593 'calc.at:1548' \ "Calculator Java %locations parse.error=custom " " " 22 at_xfail=no ( printf "%s\n" "593. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %locations %define parse.error custom %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; PositionReader reader; public CalcLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } public void reportSyntaxError(Calc.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. String msg = ctx.getLocation() + ": " + "syntax error"; { Calc.SymbolKind token = ctx.getToken(); if (token != null) msg += " on token [" + token.getName() + "]"; } { Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS]; int n = ctx.getExpectedTokens(arg, ctx.NTOKENS); if (0 < n) { msg += " (expected:"; for (int i = 0; i < n; ++i) msg += " [" + arg[i].getName() + "]"; msg += ")"; } } System.err.println(msg); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1548" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1548: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1548" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1548" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1548" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1548: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1548" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1548" printf "%s\n" "calc.at:1548" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1548" { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1548" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1548" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1548" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1548" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1548: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1548" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1548: cat stderr" at_fn_check_prepare_trace "calc.at:1548" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1548" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_593 #AT_START_594 at_fn_group_banner 594 'calc.at:1549' \ "Calculator Java %locations parse.error=detailed " "" 22 at_xfail=no ( printf "%s\n" "594. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %locations %define parse.error detailed %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; PositionReader reader; public CalcLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1549: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1549" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1549" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1549" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1549: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1549" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1549" printf "%s\n" "calc.at:1549" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1549" { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1549" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1549" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1549" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1549" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1549" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1549: cat stderr" at_fn_check_prepare_trace "calc.at:1549" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1549" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_594 #AT_START_595 at_fn_group_banner 595 'calc.at:1550' \ "Calculator Java %locations parse.error=verbose " "" 22 at_xfail=no ( printf "%s\n" "595. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %locations %define parse.error verbose %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; PositionReader reader; public CalcLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1550" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1550: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1550" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1550" printf "%s\n" "calc.at:1550" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1550" { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1550" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1550" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1550" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1550" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1550" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1550: cat stderr" at_fn_check_prepare_trace "calc.at:1550" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1550" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_595 #AT_START_596 at_fn_group_banner 596 'calc.at:1551' \ "Calculator Java parse.trace parse.error=verbose " "" 22 at_xfail=no ( printf "%s\n" "596. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.trace %define parse.error verbose %code imports { import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror ("error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } public void yyerror (String m) { System.err.println (m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; int tkind = st.nextToken(); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println("syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1551: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1551" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1551" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1551" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1551: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1551" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1551" printf "%s\n" "calc.at:1551" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1551" { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1551" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1551" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1014 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1551" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1551" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "77 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1551" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1551: cat stderr" at_fn_check_prepare_trace "calc.at:1551" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1551" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_596 #AT_START_597 at_fn_group_banner 597 'calc.at:1552' \ "Calculator Java parse.trace parse.error=verbose %locations %lex-param {InputStream is} " "" 22 at_xfail=no ( printf "%s\n" "597. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.trace %define parse.error verbose %locations %lex-param {InputStream is} %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { Calc p = new Calc (System.in); p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code lexer { StreamTokenizer st; PositionReader reader; public YYLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1552: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1552" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1552" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1552" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1552: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1552" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1552" printf "%s\n" "calc.at:1552" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1552" { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1552" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1552" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1014 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1552" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1552" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "77 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1552" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1552: cat stderr" at_fn_check_prepare_trace "calc.at:1552" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1552" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_597 #AT_START_598 at_fn_group_banner 598 'calc.at:1554' \ "Calculator Java api.push-pull=both " " " 22 at_xfail=no ( printf "%s\n" "598. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define api.push-pull both %code imports { import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror ("error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror ("error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; public CalcLexer (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } public void yyerror (String m) { System.err.println (m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; int tkind = st.nextToken(); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println("syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1554: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1554" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1554" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1554" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1554: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1554" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1554" printf "%s\n" "calc.at:1554" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1554" { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1554" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Verify that this is a push parser. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: grep -c '^.*public void push_parse_initialize ().*\$' Calc.java" at_fn_check_prepare_dynamic "grep -c '^.*public void push_parse_initialize ().*$' Calc.java" "calc.at:1554" ( $at_check_trace; grep -c '^.*public void push_parse_initialize ().*$' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1554" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1554" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1554" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. sed 's/^[-0-9.]*: //' expout >at-expout mv at-expout expout # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1554" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1554: cat stderr" at_fn_check_prepare_trace "calc.at:1554" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1554" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_598 #AT_START_599 at_fn_group_banner 599 'calc.at:1555' \ "Calculator Java api.push-pull=both parse.error=detailed %locations " "" 22 at_xfail=no ( printf "%s\n" "599. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define api.push-pull both %define parse.error detailed %locations %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; PositionReader reader; public CalcLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1555: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1555" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1555" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1555" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1555: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1555" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1555" printf "%s\n" "calc.at:1555" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1555" { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1555" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Verify that this is a push parser. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: grep -c '^.*public void push_parse_initialize ().*\$' Calc.java" at_fn_check_prepare_dynamic "grep -c '^.*public void push_parse_initialize ().*$' Calc.java" "calc.at:1555" ( $at_check_trace; grep -c '^.*public void push_parse_initialize ().*$' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1555" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1555" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1555" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1555" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1555: cat stderr" at_fn_check_prepare_trace "calc.at:1555" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_599 #AT_START_600 at_fn_group_banner 600 'calc.at:1556' \ "Calculator Java parse.trace parse.error=custom %locations %lex-param {InputStream is} api.push-pull=both " "" 22 at_xfail=no ( printf "%s\n" "600. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.trace %define parse.error custom %locations %lex-param {InputStream is} %define api.push-pull both %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { Calc p = new Calc (System.in); p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code lexer { StreamTokenizer st; PositionReader reader; public YYLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } public void reportSyntaxError(Calc.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. String msg = ctx.getLocation() + ": " + "syntax error"; { Calc.SymbolKind token = ctx.getToken(); if (token != null) msg += " on token [" + token.getName() + "]"; } { Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS]; int n = ctx.getExpectedTokens(arg, ctx.NTOKENS); if (0 < n) { msg += " (expected:"; for (int i = 0; i < n; ++i) msg += " [" + arg[i].getName() + "]"; msg += ")"; } } System.err.println(msg); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1556" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1556: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1556" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1556" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1556" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1556: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1556" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1556" printf "%s\n" "calc.at:1556" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1556" { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1556" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Verify that this is a push parser. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: grep -c '^.*public void push_parse_initialize ().*\$' Calc.java" at_fn_check_prepare_dynamic "grep -c '^.*public void push_parse_initialize ().*$' Calc.java" "calc.at:1556" ( $at_check_trace; grep -c '^.*public void push_parse_initialize ().*$' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1556" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1556" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1014 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1556" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1556: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1556" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "77 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1556: cat stderr" at_fn_check_prepare_trace "calc.at:1556" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1556" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_600 #AT_START_601 at_fn_group_banner 601 'calc.at:1557' \ "Calculator Java parse.trace parse.error=verbose %locations %lex-param {InputStream is} api.push-pull=both " "" 22 at_xfail=no ( printf "%s\n" "601. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.trace %define parse.error verbose %locations %lex-param {InputStream is} %define api.push-pull both %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { Calc p = new Calc (System.in); p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } } /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code lexer { StreamTokenizer st; PositionReader reader; public YYLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1557: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1557" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1557" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1557" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1557: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1557" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1557" printf "%s\n" "calc.at:1557" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1557" { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1557" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Verify that this is a push parser. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: grep -c '^.*public void push_parse_initialize ().*\$' Calc.java" at_fn_check_prepare_dynamic "grep -c '^.*public void push_parse_initialize ().*$' Calc.java" "calc.at:1557" ( $at_check_trace; grep -c '^.*public void push_parse_initialize ().*$' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1557" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1014 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of input] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1557" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of input] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1557" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "77 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: \"\$PERL\" -pi -e 'use strict; s{syntax error on token \\[(.*?)\\] \\(expected: (.*)\\)} { my \$unexp = \$1; my @exps = \$2 =~ /\\[(.*?)\\]/g; (\$#exps && \$#exps < 4) ? \"syntax error, unexpected \$unexp, expecting @{[join(\\\" or \\\", @exps)]}\" : \"syntax error, unexpected \$unexp\"; }eg ' expout || exit 77" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1557" ( $at_check_trace; "$PERL" -pi -e 'use strict; s{syntax error on token \[(.*?)\] \(expected: (.*)\)} { my $unexp = $1; my @exps = $2 =~ /\[(.*?)\]/g; ($#exps && $#exps < 4) ? "syntax error, unexpected $unexp, expecting @{[join(\" or \", @exps)]}" : "syntax error, unexpected $unexp"; }eg ' expout || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1557: cat stderr" at_fn_check_prepare_trace "calc.at:1557" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1557" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_601 #AT_START_602 at_fn_group_banner 602 'calc.at:1560' \ "Calculator Java parse.trace parse.error=custom %locations parse.lac=full " "" 22 at_xfail=no ( printf "%s\n" "602. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.trace %define parse.error custom %locations %define parse.lac full %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; PositionReader reader; public CalcLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } public void reportSyntaxError(Calc.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. String msg = ctx.getLocation() + ": " + "syntax error"; { Calc.SymbolKind token = ctx.getToken(); if (token != null) msg += " on token [" + token.getName() + "]"; } { Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS]; int n = ctx.getExpectedTokens(arg, ctx.NTOKENS); if (0 < n) { msg += " (expected:"; for (int i = 0; i < n; ++i) msg += " [" + arg[i].getName() + "]"; msg += ")"; } } System.err.println(msg); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1560" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1560" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1560" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1560" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1560: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1560" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1560" printf "%s\n" "calc.at:1560" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1560" { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1560" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1560" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1560" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1014 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1560" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1560: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1560" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "77 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1560: cat stderr" at_fn_check_prepare_trace "calc.at:1560" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1560" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_602 #AT_START_603 at_fn_group_banner 603 'calc.at:1561' \ "Calculator Java parse.trace parse.error=custom %locations api.push-pull=both parse.lac=full " "" 22 at_xfail=no ( printf "%s\n" "603. $at_setup_line: testing $at_desc ..." $at_traceon cat >Calc.y <<'_ATEOF' /* Infix notation calculator--calc */ %define api.prefix {Calc} %define api.parser.class {Calc} %define public %language "Java" %define parse.trace %define parse.error custom %locations %define api.push-pull both %define parse.lac full %code imports { import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; } %code { public static void main (String[] args) throws IOException { CalcLexer l = new CalcLexer (System.in); Calc p = new Calc (l); p.setDebugLevel (1); boolean success = p.parse (); if (!success) System.exit (1); } static String i18n(String s) { if (s.equals ("end of input")) return "end of file"; else if (s.equals ("number")) return "nombre"; else return s; } } /* Bison Declarations */ %token CALC_EOF 0 _("end of file") %token NUM "number" %type exp %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' %precedence NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\n' | exp '\n' ; exp: NUM | exp '=' exp { if ($1.intValue () != $3.intValue ()) yyerror (@$, "error: " + $1 + " != " + $3); } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { if ($3.intValue () == 0) yyerror (@3, "error: null divisor"); else $$ = $1 / $3; } | '-' exp %prec NEG { $$ = -$2; } | exp '^' exp { $$ = (int) Math.pow ($1, $3); } | '(' exp ')' { $$ = $2; } | '(' error ')' { $$ = 1111; } | '-' error { $$ = 0; return YYERROR; } | '!' '!' { $$ = 0; return YYERROR; } | '!' '+' { $$ = 0; return YYACCEPT; } | '!' '-' { $$ = 0; return YYABORT; } ; %code epilogue { class CalcLexer implements Calc.Lexer { StreamTokenizer st; PositionReader reader; public CalcLexer (InputStream is) { reader = new PositionReader (new InputStreamReader (is)); st = new StreamTokenizer (reader); st.resetSyntax (); st.eolIsSignificant (true); st.wordChars ('0', '9'); } Position start = new Position (1, 0); Position end = new Position (1, 0); public Position getStartPos () { return new Position (start); } public Position getEndPos () { return new Position (end); } public void yyerror (Calc.Location l, String m) { if (l == null) System.err.println(m); else System.err.println(l + ": " + m); } public void reportSyntaxError(Calc.Context ctx) { // Buffer and print the message at the end, to avoid being intertwined // with debug traces from getExpectedTokens. String msg = ctx.getLocation() + ": " + "syntax error"; { Calc.SymbolKind token = ctx.getToken(); if (token != null) msg += " on token [" + token.getName() + "]"; } { Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS]; int n = ctx.getExpectedTokens(arg, ctx.NTOKENS); if (0 < n) { msg += " (expected:"; for (int i = 0; i < n; ++i) msg += " [" + arg[i].getName() + "]"; msg += ")"; } } System.err.println(msg); } Integer yylval; public Object getLVal () { return yylval; } public int yylex() throws IOException {; start.set(reader.getPosition()); int tkind = st.nextToken(); end.set(reader.getPosition()); switch (tkind) { case StreamTokenizer.TT_EOF: return CALC_EOF; case StreamTokenizer.TT_EOL:; end.line += 1; end.column = 0; return (int) '\n'; case StreamTokenizer.TT_WORD: yylval = Integer.parseInt(st.sval); end.set(reader.getPreviousPosition()); return NUM; case ' ': case '\t': return yylex(); case '#': System.err.println(start + ": " + "syntax error: invalid character: '#'"); return YYerror; default: return tkind; } } } }; %% class Position { public int line = 1; public int column = 1; public Position () { line = 1; column = 1; } public Position (int l, int t) { line = l; column = t; } public Position (Position p) { line = p.line; column = p.column; } public void set (Position p) { line = p.line; column = p.column; } public boolean equals (Position l) { return l.line == line && l.column == column; } public String toString () { return Integer.toString (line) + "." + Integer.toString (column); } public int line () { return line; } public int column () { return column; } } class PositionReader extends BufferedReader { private Position position = new Position (); private Position previousPosition = new Position (); public PositionReader (Reader reader) { super (reader); } public int read () throws IOException { int res = super.read (); previousPosition.set (position); if (res > -1) { char c = (char)res; if (c == '\r' || c == '\n') { position.line += 1; position.column = 1; } else { position.column += 1; } } return res; } public Position getPosition () { return position; } public Position getPreviousPosition () { return previousPosition; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1561" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1561: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y" "calc.at:1561" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1561" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "calc.at:1561" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/calc.at:1561: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated -o Calc.java Calc.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "calc.at:1561" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1561" printf "%s\n" "calc.at:1561" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/calc.at:1561" { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \$SHELL ../../../javacomp.sh Calc.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Calc.java" "calc.at:1561" ( $at_check_trace; $SHELL ../../../javacomp.sh Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Verify that this is a push parser. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: grep -c '^.*public void push_parse_initialize ().*\$' Calc.java" at_fn_check_prepare_dynamic "grep -c '^.*public void push_parse_initialize ().*$' Calc.java" "calc.at:1561" ( $at_check_trace; grep -c '^.*public void push_parse_initialize ().*$' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \"\$PERL\" -ne ' chomp; print \"\$ARGV:\$.: {\$_}\\n\" if (# No starting/ending empty lines. (eof || \$. == 1) && /^\\s*\$/ # No trailing space. || /\\s\$/ # No tabs. || /\\t/ )' Calc.java " at_fn_check_prepare_notrace 'an embedded newline' "calc.at:1561" ( $at_check_trace; "$PERL" -ne ' chomp; print "$ARGV:$.: {$_}\n" if (# No starting/ending empty lines. (eof || $. == 1) && /^\s*$/ # No trailing space. || /\s$/ # No tabs. || /\t/ )' Calc.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } fi # Test the precedences. # The Java traces do not show the clean up sequence at the end, # since it does not support %destructor. cat >input <<'_ATEOF' 1 + 2 * 3 = 7 1 + 2 * -3 = -5 -1^2 = -1 (-1)^2 = 1 ---1 = -1 1 - 2 - 3 = -4 1 - (2 - 3) = 2 2^2^3 = 256 (2^2)^3 = 64 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1561" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1014 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Some syntax errors. cat >input <<'_ATEOF' 1 2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1//2 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.3-1.4: syntax error on token ['/'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' error _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1-1.2: syntax error on token [invalid token] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' 1 = 2 = 3 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.7-1.8: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' +1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 2.1-2.2: syntax error on token ['+'] (expected: [end of file] [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Exercise error messages with EOF: work on an empty file. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \$SHELL ../../../javaexec.sh Calc < /dev/null" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Calc < /dev/null" "calc.at:1561" ( $at_check_trace; $SHELL ../../../javaexec.sh Calc < /dev/null ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.1: syntax error on token [end of file] (expected: [number] ['-'] ['\n'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Exercise the error token: without it, we die at the first error, # hence be sure to # # - have several errors which exercise different shift/discardings # - (): nothing to pop, nothing to discard # - (1 + 1 + 1 +): a lot to pop, nothing to discard # - (* * *): nothing to pop, a lot to discard # - (1 + 2 * *): some to pop and discard # # - test the action associated to 'error' # # - check the lookahead that triggers an error is not discarded # when we enter error recovery. Below, the lookahead causing the # first error is ")", which is needed to recover from the error and # produce the "0" that triggers the "0 != 1" error. # cat >input <<'_ATEOF' () + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.18-1.19: syntax error on token [')'] (expected: [number] ['-'] ['('] ['!']) 1.23-1.24: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.41-1.42: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.1-1.47: error: 4444 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # The same, but this time exercising explicitly triggered syntax errors. # POSIX says the lookahead causing the error should not be discarded. cat >input <<'_ATEOF' (!!) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.12: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.17: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (- *) + (1 2) = 1 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.4-1.5: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.12-1.13: syntax error on token [number] (expected: ['='] ['-'] ['+'] ['*'] ['/'] ['^'] [')']) 1.1-1.18: error: 2222 != 1 _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Check that yyerrok works properly: second error is not reported, # third and fourth are. Parse status is successful. cat >input <<'_ATEOF' (* *) + (*) + (*) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2-1.3: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.10-1.11: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) 1.16-1.17: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!']) _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Special actions. # ---------------- # !+ => YYACCEPT, !- => YYABORT, !! => YYERROR, !* => YYNOMEM. # YYACCEPT. # Java lacks the traces at the end for cleaning the stack # -Stack now 0 8 20 # -Cleanup: popping token '+' (1.1: ) # -Cleanup: popping nterm exp (1.1: 7) cat >input <<'_ATEOF' 1 + 2 * 3 + !+ ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/calc.at:1561: \$EGREP -c -v 'Return for a new token:|LAC:' stderr" at_fn_check_prepare_notrace 'a shell pipeline' "calc.at:1561" ( $at_check_trace; $EGREP -c -v 'Return for a new token:|LAC:' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "77 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # YYABORT. cat >input <<'_ATEOF' 1 + 2 * 3 + !- ++ _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # YYerror. # -------- # Check that returning YYerror from the scanner properly enters # error-recovery without issuing a second error message. cat >input <<'_ATEOF' (#) + (#) = 2222 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' 1.8: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + #) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (# + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.2: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + # + 1) = 1111 _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.6: syntax error: invalid character: '#' _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } cat >input <<'_ATEOF' (1 + 1) / (1 - 1) _ATEOF echo "input:" sed -e 's/^/ | /' >"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Normalize the observed and expected error messages, depending upon the # options. # 1. Remove the traces from observed. sed ' / \$[0-9$]* = /d /^Cleanup:/d /^Discarding/d /^Entering/d /^Error:/d /^LAC:/d /^Next/d /^Now/d /^Reading/d /^Reducing/d /^Return/d /^Shifting/d /^Stack/d /^Starting/d /^state/d /^yydestructor:/d ' stderr >at-stderr mv at-stderr stderr # 2. Create the reference error message. cat >expout <<'_ATEOF' 1.11-1.18: error: null divisor _ATEOF # 3. If locations are not used, remove them. # 4. If parse.error is not custom, turn the expected message to # the traditional one. # 5. If parse.error is simple, strip the', unexpected....' part. # 6. Actually check. { set +x printf "%s\n" "$at_srcdir/calc.at:1561: cat stderr" at_fn_check_prepare_trace "calc.at:1561" ( $at_check_trace; cat stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/calc.at:1561" $at_failed && at_fn_log_failure $at_traceon; } # Multiple start symbols. set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_603 #AT_START_604 at_fn_group_banner 604 'torture.at:132' \ "Big triangle" " " 23 at_xfail=no ( printf "%s\n" "604. $at_setup_line: testing $at_desc ..." $at_traceon # I have been able to go up to 2000 on my machine. # I tried 3000, a 29Mb grammar file, but then my system killed bison. # With 500 and the new parser, which consume far too much memory, # it gets killed too. Of course the parser is to be cleaned. cat >gengram.pl <<'_ATEOF' #! /usr/bin/perl -w use strict; my $max = $ARGV[0] || 10; print < } %define parse.error verbose %debug %{ #include #include #include #define MAX $max static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %union { int val; }; %token END "end" %type exp input EOF for my $size (1 .. $max) { print "%token t$size $size \"$size\"\n"; }; print < MAX) return 0; else if (inner > outer) { inner = 1; ++outer; return END; } return inner++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } EOF _ATEOF { set +x printf "%s\n" "$at_srcdir/torture.at:138: \"\$PERL\" -w ./gengram.pl 200 || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -w ./gengram.pl 200 || exit 77" "torture.at:138" ( $at_check_trace; "$PERL" -w ./gengram.pl 200 || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:138" $at_failed && at_fn_log_failure $at_traceon; } mv stdout input.y { set +x printf "%s\n" "$at_srcdir/torture.at:139: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y" at_fn_check_prepare_trace "torture.at:139" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:139" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:140" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:140" { set +x printf "%s\n" "$at_srcdir/torture.at:140: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:140" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:140" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:141: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:141" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:141" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:141: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:141" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:141" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_604 #AT_START_605 at_fn_group_banner 605 'torture.at:216' \ "Big horizontal" " " 23 at_xfail=no ( printf "%s\n" "605. $at_setup_line: testing $at_desc ..." $at_traceon # I have been able to go up to 10000 on my machine, but I had to # increase the maximum stack size (* 100). It gave: # # input.y 263k # input.tab.c 1.3M # input 453k # # gengram.pl 10000 0.70s user 0.01s sys 99% cpu 0.711 total # bison input.y 730.56s user 0.53s sys 99% cpu 12:12.34 total # gcc -Wall input.tab.c -o input 5.81s user 0.20s sys 100% cpu 6.01 total # ./input 0.00s user 0.01s sys 108% cpu 0.01 total # cat >gengram.pl <<'_ATEOF' #! /usr/bin/perl -w use strict; my $max = $ARGV[0] || 10; print < } %define parse.error verbose %debug %{ #include #include #define MAX $max static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %token EOF for my $size (1 .. $max) { print " t$size $size \"$size\"\n"; }; print < /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int counter = 1; if (counter <= MAX) return counter++; assert (counter++ == MAX + 1); return 0; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } EOF _ATEOF { set +x printf "%s\n" "$at_srcdir/torture.at:230: \"\$PERL\" -w ./gengram.pl 1000 || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -w ./gengram.pl 1000 || exit 77" "torture.at:230" ( $at_check_trace; "$PERL" -w ./gengram.pl 1000 || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:230" $at_failed && at_fn_log_failure $at_traceon; } mv stdout input.y # GNU m4 requires about 70 MiB for this test on a 32-bit host. # Ask for 200 MiB, which should be plenty even on a 64-bit host. data_limit=`(ulimit -S -d) 2>/dev/null` case $data_limit in [0-9]*) if test "$data_limit" -lt 204000; then { set +x printf "%s\n" "$at_srcdir/torture.at:234: ulimit -S -d 204000 || exit 77" at_fn_check_prepare_trace "torture.at:234" ( $at_check_trace; ulimit -S -d 204000 || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:234" $at_failed && at_fn_log_failure $at_traceon; } ulimit -S -d 204000 fi esac { set +x printf "%s\n" "$at_srcdir/torture.at:236: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "torture.at:236" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:236" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:237" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:237" { set +x printf "%s\n" "$at_srcdir/torture.at:237: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:237" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:237" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:238: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:238" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:238" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:238: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:238" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:238" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_605 #AT_START_606 at_fn_group_banner 606 'torture.at:270' \ "State number type: 128 states" " " 23 at_xfail=no ( printf "%s\n" "606. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:270: ruby \$abs_top_srcdir/tests/linear 128 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 128 >input.y || exit 77" "torture.at:270" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 128 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:270: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:270" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:270: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:270" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:270: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:270" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:270: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:270" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:270: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:270" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:270: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:270" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:270" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:270" { set +x printf "%s\n" "$at_srcdir/torture.at:270: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:270" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:270: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:270" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "128 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:270: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:270" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "yytype_int8 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:270: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:270" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:270: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:270" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:270" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_606 #AT_START_607 at_fn_group_banner 607 'torture.at:271' \ "State number type: 129 states" " " 23 at_xfail=no ( printf "%s\n" "607. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:271: ruby \$abs_top_srcdir/tests/linear 129 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 129 >input.y || exit 77" "torture.at:271" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 129 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:271: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:271" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:271: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:271" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:271: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:271" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:271: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:271" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:271: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:271" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:271: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:271" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:271" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:271" { set +x printf "%s\n" "$at_srcdir/torture.at:271: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:271" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:271: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:271" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "129 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:271: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:271" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "yytype_uint8 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:271: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:271" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:271: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:271" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:271" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_607 #AT_START_608 at_fn_group_banner 608 'torture.at:272' \ "State number type: 256 states" " " 23 at_xfail=no ( printf "%s\n" "608. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:272: ruby \$abs_top_srcdir/tests/linear 256 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 256 >input.y || exit 77" "torture.at:272" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 256 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:272: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:272" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:272: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:272" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:272: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:272" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:272: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:272" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:272" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:272" { set +x printf "%s\n" "$at_srcdir/torture.at:272: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:272" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:272: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:272" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "256 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:272: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:272" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "yytype_uint8 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:272: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:272" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:272: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:272" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:272" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_608 #AT_START_609 at_fn_group_banner 609 'torture.at:273' \ "State number type: 257 states" " " 23 at_xfail=no ( printf "%s\n" "609. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:273: ruby \$abs_top_srcdir/tests/linear 257 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 257 >input.y || exit 77" "torture.at:273" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 257 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:273: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:273" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:273: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:273" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:273: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:273" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:273: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:273" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:273: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:273" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:273: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:273" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:273" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:273" { set +x printf "%s\n" "$at_srcdir/torture.at:273: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:273" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:273: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:273" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "257 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:273: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:273" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "yytype_int16 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:273: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:273" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:273: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:273" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:273" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_609 #AT_START_610 at_fn_group_banner 610 'torture.at:274' \ "State number type: 32768 states" " " 23 at_xfail=no ( printf "%s\n" "610. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:274: ruby \$abs_top_srcdir/tests/linear 32768 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 32768 >input.y || exit 77" "torture.at:274" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 32768 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:274: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:274" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:274: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:274" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:274: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:274" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:274: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:274" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:274: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:274" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:274: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:274" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:274" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:274" { set +x printf "%s\n" "$at_srcdir/torture.at:274: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:274" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:274: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:274" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "32768 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:274: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:274" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "yytype_int16 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:274: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:274" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:274: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:274" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:274" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_610 #AT_START_611 at_fn_group_banner 611 'torture.at:275' \ "State number type: 65536 states" " " 23 at_xfail=no ( printf "%s\n" "611. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:275: ruby \$abs_top_srcdir/tests/linear 65536 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 65536 >input.y || exit 77" "torture.at:275" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 65536 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:275: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:275" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:275: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:275" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:275: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:275" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:275: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:275" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:275: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:275" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:275: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:275" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:275" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:275" { set +x printf "%s\n" "$at_srcdir/torture.at:275: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:275" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:275: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:275" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "65536 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:275: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:275" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "yytype_uint16 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:275: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:275" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:275: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:275" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:275" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_611 #AT_START_612 at_fn_group_banner 612 'torture.at:276' \ "State number type: 65537 states" " " 23 at_xfail=no ( printf "%s\n" "612. $at_setup_line: testing $at_desc ..." $at_traceon { set +x printf "%s\n" "$at_srcdir/torture.at:276: ruby \$abs_top_srcdir/tests/linear 65537 >input.y || exit 77" at_fn_check_prepare_dynamic "ruby $abs_top_srcdir/tests/linear 65537 >input.y || exit 77" "torture.at:276" ( $at_check_trace; ruby $abs_top_srcdir/tests/linear 65537 >input.y || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } # Old versions of GCC reject large values given to #line. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:276: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --no-line -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:276" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:276: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y" "torture.at:276" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:276: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:276" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:276: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:276" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:276: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:276" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:276: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y" at_fn_check_prepare_trace "torture.at:276" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --no-line -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:276" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:276" { set +x printf "%s\n" "$at_srcdir/torture.at:276: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:276" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:276: sed -ne 's/#define YYNSTATES *\\([0-9]*\\)/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:276" ( $at_check_trace; sed -ne 's/#define YYNSTATES *\([0-9]*\)/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "65537 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:276: sed -ne 's/typedef \\(.*\\) yy_state_t;/\\1/p' input.c" at_fn_check_prepare_trace "torture.at:276" ( $at_check_trace; sed -ne 's/typedef \(.*\) yy_state_t;/\1/p' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "int " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:276: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:276" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:276: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:276" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:276" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_612 #AT_START_613 at_fn_group_banner 613 'torture.at:385' \ "Many lookahead tokens" " " 23 at_xfail=no ( printf "%s\n" "613. $at_setup_line: testing $at_desc ..." $at_traceon cat >gengram.pl <<'_ATEOF' #! /usr/bin/perl -w use strict; use Text::Wrap; my $max = $ARGV[0] || 10; print < # include # include # include # define MAX $max static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %union { int val; }; %type input exp %token token EOF print wrap ("%type ", " ", map { "n$_" } (1 .. $max)), "\n"; print "%token\n"; for my $count (1 .. $max) { print " t$count $count \"$count\"\n"; }; print < MAX) { assert (counter++ == MAX + 1); return 0; } if (return_token) { return_token = 0; return token; } return_token = 1; return counter++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } EOF _ATEOF { set +x printf "%s\n" "$at_srcdir/torture.at:387: \"\$PERL\" -w ./gengram.pl 1000 || exit 77" at_fn_check_prepare_dynamic "\"$PERL\" -w ./gengram.pl 1000 || exit 77" "torture.at:387" ( $at_check_trace; "$PERL" -w ./gengram.pl 1000 || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:387" $at_failed && at_fn_log_failure $at_traceon; } mv stdout input.y # GNU m4 requires about 70 MiB for this test on a 32-bit host. # Ask for 200 MiB, which should be plenty even on a 64-bit host. data_limit=`(ulimit -S -d) 2>/dev/null` case $data_limit in [0-9]*) if test "$data_limit" -lt 204000; then { set +x printf "%s\n" "$at_srcdir/torture.at:391: ulimit -S -d 204000 || exit 77" at_fn_check_prepare_trace "torture.at:391" ( $at_check_trace; ulimit -S -d 204000 || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:391" $at_failed && at_fn_log_failure $at_traceon; } ulimit -S -d 204000 fi esac if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:393: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:393" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:393: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" "torture.at:393" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:393" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:393: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:393" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:393" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:393: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:393" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:393" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:393: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:393" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:393" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:393: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y" at_fn_check_prepare_trace "torture.at:393" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:393" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:394" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:394" { set +x printf "%s\n" "$at_srcdir/torture.at:394: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:394" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:395: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "torture.at:395" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:395" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:395: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:395" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:395" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_613 #AT_START_614 at_fn_group_banner 614 'torture.at:485' \ "Exploding the Stack Size with Alloca" " " 23 at_xfail=no ( printf "%s\n" "614. $at_setup_line: testing $at_desc ..." $at_traceon # A grammar of parens growing the stack thanks to right recursion. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include #include #if (defined __GNUC__ || defined __BUILTIN_VA_ARG_INCR \ || defined _AIX || defined _MSC_VER || defined _ALLOCA_H) # define YYSTACK_USE_ALLOCA 1 #endif static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %define parse.error verbose %token WAIT_FOR_EOF %% exp: WAIT_FOR_EOF exp | %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { assert (0 <= yylval); if (yylval--) return WAIT_FOR_EOF; else return EOF; } /* Return argv[1] as an int. */ static int get_args (int argc, const char **argv) { long res; char *endp; assert (argc == 2); (void) argc; res = strtol (argv[1], &endp, 10); assert (argv[1] != endp); assert (0 <= res); assert (res <= INT_MAX); assert (errno != ERANGE); return YY_CAST (int, res); } int main (int argc, const char **argv) { YYSTYPE yylval_init = get_args (argc, argv); int status = 0; int count; for (count = 0; count < 2; ++count) { int new_status; yylval = yylval_init; new_status = yyparse (); if (count == 0) status = new_status; else assert (new_status == status); } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "torture.at:494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:494: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:494" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:494: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:494" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:494: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:494" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:494: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "torture.at:494" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:494" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:494" { set +x printf "%s\n" "$at_srcdir/torture.at:494: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:494" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:494" $at_failed && at_fn_log_failure $at_traceon; } # Below the limit of 200. { set +x printf "%s\n" "$at_srcdir/torture.at:497: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20" "torture.at:497" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:497" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:497: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:497" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:497" $at_failed && at_fn_log_failure $at_traceon; } # Two enlargements: 2 * 2 * 200. { set +x printf "%s\n" "$at_srcdir/torture.at:500: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900" "torture.at:500" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:500" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:500: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:500" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:500" $at_failed && at_fn_log_failure $at_traceon; } # Fails: beyond the limit of 10,000 (which we don't reach anyway since we # multiply by two starting at 200 => 5120 is the last possible). { set +x printf "%s\n" "$at_srcdir/torture.at:504: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000" "torture.at:504" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/torture.at:504" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:504: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:504" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:504" $at_failed && at_fn_log_failure $at_traceon; } # The push parser can't use alloca since the stacks can't be locals. This test # just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect # push parsers. # A grammar of parens growing the stack thanks to right recursion. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include #include #if (defined __GNUC__ || defined __BUILTIN_VA_ARG_INCR \ || defined _AIX || defined _MSC_VER || defined _ALLOCA_H) # define YYSTACK_USE_ALLOCA 1 #endif static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %define api.push-pull both %define parse.error verbose %token WAIT_FOR_EOF %% exp: WAIT_FOR_EOF exp | %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { assert (0 <= yylval); if (yylval--) return WAIT_FOR_EOF; else return EOF; } /* Return argv[1] as an int. */ static int get_args (int argc, const char **argv) { long res; char *endp; assert (argc == 2); (void) argc; res = strtol (argv[1], &endp, 10); assert (argv[1] != endp); assert (0 <= res); assert (res <= INT_MAX); assert (errno != ERANGE); return YY_CAST (int, res); } int main (int argc, const char **argv) { YYSTYPE yylval_init = get_args (argc, argv); int status = 0; int count; yypstate *ps = yypstate_new (); for (count = 0; count < 2; ++count) { int new_status; yylval = yylval_init; new_status = yypull_parse (ps); if (count == 0) status = new_status; else assert (new_status == status); } yypstate_delete (ps); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:510: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:510" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:510: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "torture.at:510" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:510: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:510" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:510: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:510" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:510: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:510" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:510: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "torture.at:510" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:510" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:510" { set +x printf "%s\n" "$at_srcdir/torture.at:510: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:510" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:510" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:513: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20" "torture.at:513" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:513" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:513: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:513" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:513" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:515: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900" "torture.at:515" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:515" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:515: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:515" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:515" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:517: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000" "torture.at:517" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/torture.at:517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:517: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:517" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:517" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_614 #AT_START_615 at_fn_group_banner 615 'torture.at:531' \ "Exploding the Stack Size with Malloc" " " 23 at_xfail=no ( printf "%s\n" "615. $at_setup_line: testing $at_desc ..." $at_traceon # A grammar of parens growing the stack thanks to right recursion. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include #include #define YYSTACK_USE_ALLOCA 0 static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %define parse.error verbose %token WAIT_FOR_EOF %% exp: WAIT_FOR_EOF exp | %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { assert (0 <= yylval); if (yylval--) return WAIT_FOR_EOF; else return EOF; } /* Return argv[1] as an int. */ static int get_args (int argc, const char **argv) { long res; char *endp; assert (argc == 2); (void) argc; res = strtol (argv[1], &endp, 10); assert (argv[1] != endp); assert (0 <= res); assert (res <= INT_MAX); assert (errno != ERANGE); return YY_CAST (int, res); } int main (int argc, const char **argv) { YYSTYPE yylval_init = get_args (argc, argv); int status = 0; int count; for (count = 0; count < 2; ++count) { int new_status; yylval = yylval_init; new_status = yyparse (); if (count == 0) status = new_status; else assert (new_status == status); } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:535: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:535" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:535: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "torture.at:535" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:535: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:535" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:535: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:535" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:535: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:535" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:535: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "torture.at:535" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:535" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:535" { set +x printf "%s\n" "$at_srcdir/torture.at:535: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:535" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:535" $at_failed && at_fn_log_failure $at_traceon; } # Below the limit of 200. { set +x printf "%s\n" "$at_srcdir/torture.at:538: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20" "torture.at:538" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:538" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:538: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:538" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:538" $at_failed && at_fn_log_failure $at_traceon; } # Two enlargements: 2 * 2 * 200. { set +x printf "%s\n" "$at_srcdir/torture.at:541: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900" "torture.at:541" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:541" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:541: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:541" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:541" $at_failed && at_fn_log_failure $at_traceon; } # Fails: beyond the limit of 10,000 (which we don't reach anyway since we # multiply by two starting at 200 => 5120 is the possible). { set +x printf "%s\n" "$at_srcdir/torture.at:545: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000" "torture.at:545" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/torture.at:545" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:545: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:545" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:545" $at_failed && at_fn_log_failure $at_traceon; } # A grammar of parens growing the stack thanks to right recursion. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include #include #define YYSTACK_USE_ALLOCA 0 static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %define api.push-pull both %define parse.error verbose %token WAIT_FOR_EOF %% exp: WAIT_FOR_EOF exp | %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { assert (0 <= yylval); if (yylval--) return WAIT_FOR_EOF; else return EOF; } /* Return argv[1] as an int. */ static int get_args (int argc, const char **argv) { long res; char *endp; assert (argc == 2); (void) argc; res = strtol (argv[1], &endp, 10); assert (argv[1] != endp); assert (0 <= res); assert (res <= INT_MAX); assert (errno != ERANGE); return YY_CAST (int, res); } int main (int argc, const char **argv) { YYSTYPE yylval_init = get_args (argc, argv); int status = 0; int count; yypstate *ps = yypstate_new (); for (count = 0; count < 2; ++count) { int new_status; yylval = yylval_init; new_status = yypull_parse (ps); if (count == 0) status = new_status; else assert (new_status == status); } yypstate_delete (ps); return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/torture.at:548: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "torture.at:548" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:548: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "torture.at:548" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/torture.at:548: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:548" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/torture.at:548: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "torture.at:548" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/torture.at:548: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "torture.at:548" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/torture.at:548: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "torture.at:548" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "torture.at:548" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/torture.at:548" { set +x printf "%s\n" "$at_srcdir/torture.at:548: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "torture.at:548" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/torture.at:548" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:551: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 20" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 20" "torture.at:551" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 20 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:551: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:551" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:551" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:553: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 900" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 900" "torture.at:553" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 900 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:553" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:553: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:553" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:553" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:555: VALGRIND_OPTS=\"\$VALGRIND_OPTS --log-fd=1\" \$PREPARSER ./input 10000" at_fn_check_prepare_dynamic "VALGRIND_OPTS=\"$VALGRIND_OPTS --log-fd=1\" $PREPARSER ./input 10000" "torture.at:555" ( $at_check_trace; VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1" $PREPARSER ./input 10000 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/torture.at:555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/torture.at:555: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "torture.at:555" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/torture.at:555" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_615 #AT_START_616 at_fn_group_banner 616 'existing.at:74' \ "GNU AWK 3.1.0 Grammar: LALR(1)" " " 24 at_xfail=no ( printf "%s\n" "616. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %define parse.error verbose %token FUNC_CALL NAME REGEXP %token ERROR %token YNUMBER YSTRING %token RELOP APPEND_OP %token ASSIGNOP MATCHOP NEWLINE CONCAT_OP %token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE %token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE %token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION %token LEX_GETLINE LEX_NEXTFILE %token LEX_IN %token LEX_AND LEX_OR INCREMENT DECREMENT %token LEX_BUILTIN LEX_LENGTH /* Lowest to highest */ %right ASSIGNOP %right '?' ':' %left LEX_OR %left LEX_AND %left LEX_GETLINE %nonassoc LEX_IN %left FUNC_CALL LEX_BUILTIN LEX_LENGTH %nonassoc ',' %nonassoc MATCHOP %nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO %left CONCAT_OP %left YSTRING YNUMBER %left '+' '-' %left '*' '/' '%' %right '!' UNARY %right '^' %left INCREMENT DECREMENT %left '$' %left '(' ')' %% start : opt_nls program opt_nls ; program : rule | program rule | error | program error | /* empty */ ; rule : LEX_BEGIN {} action | LEX_END {} action | LEX_BEGIN statement_term | LEX_END statement_term | pattern action | action | pattern statement_term | function_prologue function_body ; func_name : NAME | FUNC_CALL | lex_builtin ; lex_builtin : LEX_BUILTIN | LEX_LENGTH ; function_prologue : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls ; function_body : l_brace statements r_brace opt_semi opt_nls | l_brace r_brace opt_semi opt_nls ; pattern : exp | exp ',' exp ; regexp /* * In this rule, want_regexp tells yylex that the next thing * is a regexp so it should read up to the closing slash. */ : '/' {} REGEXP '/' ; action : l_brace statements r_brace opt_semi opt_nls | l_brace r_brace opt_semi opt_nls ; statements : statement | statements statement | error | statements error ; statement_term : nls | semi opt_nls ; statement : semi opt_nls | l_brace r_brace | l_brace statements r_brace | if_statement | LEX_WHILE '(' exp r_paren opt_nls statement | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement | LEX_BREAK statement_term | LEX_CONTINUE statement_term | print '(' expression_list r_paren output_redir statement_term | print opt_rexpression_list output_redir statement_term | LEX_NEXT statement_term | LEX_NEXTFILE statement_term | LEX_EXIT opt_exp statement_term | LEX_RETURN {} opt_exp statement_term | LEX_DELETE NAME '[' expression_list ']' statement_term | LEX_DELETE NAME statement_term | exp statement_term ; print : LEX_PRINT | LEX_PRINTF ; if_statement : LEX_IF '(' exp r_paren opt_nls statement | LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement ; nls : NEWLINE | nls NEWLINE ; opt_nls : /* empty */ | nls ; input_redir : /* empty */ | '<' simp_exp ; output_redir : /* empty */ | '>' exp | APPEND_OP exp | '|' exp | TWOWAYIO exp ; opt_param_list : /* empty */ | param_list ; param_list : NAME | param_list comma NAME | error | param_list error | param_list comma error ; /* optional expression, as in for loop */ opt_exp : /* empty */ | exp ; opt_rexpression_list : /* empty */ | rexpression_list ; rexpression_list : rexp | rexpression_list comma rexp | error | rexpression_list error | rexpression_list error rexp | rexpression_list comma error ; opt_expression_list : /* empty */ | expression_list ; expression_list : exp | expression_list comma exp | error | expression_list error | expression_list error exp | expression_list comma error ; /* Expressions, not including the comma operator. */ exp : variable ASSIGNOP {} exp | '(' expression_list r_paren LEX_IN NAME | exp '|' LEX_GETLINE opt_variable | exp TWOWAYIO LEX_GETLINE opt_variable | LEX_GETLINE opt_variable input_redir | exp LEX_AND exp | exp LEX_OR exp | exp MATCHOP exp | regexp | '!' regexp %prec UNARY | exp LEX_IN NAME | exp RELOP exp | exp '<' exp | exp '>' exp | exp '?' exp ':' exp | simp_exp | exp simp_exp %prec CONCAT_OP ; rexp : variable ASSIGNOP {} rexp | rexp LEX_AND rexp | rexp LEX_OR rexp | LEX_GETLINE opt_variable input_redir | regexp | '!' regexp %prec UNARY | rexp MATCHOP rexp | rexp LEX_IN NAME | rexp RELOP rexp | rexp '?' rexp ':' rexp | simp_exp | rexp simp_exp %prec CONCAT_OP ; simp_exp : non_post_simp_exp /* Binary operators in order of decreasing precedence. */ | simp_exp '^' simp_exp | simp_exp '*' simp_exp | simp_exp '/' simp_exp | simp_exp '%' simp_exp | simp_exp '+' simp_exp | simp_exp '-' simp_exp | variable INCREMENT | variable DECREMENT ; non_post_simp_exp : '!' simp_exp %prec UNARY | '(' exp r_paren | LEX_BUILTIN '(' opt_expression_list r_paren | LEX_LENGTH '(' opt_expression_list r_paren | LEX_LENGTH | FUNC_CALL '(' opt_expression_list r_paren | variable | INCREMENT variable | DECREMENT variable | YNUMBER | YSTRING | '-' simp_exp %prec UNARY | '+' simp_exp %prec UNARY ; opt_variable : /* empty */ | variable ; variable : NAME | NAME '[' expression_list ']' | '$' non_post_simp_exp ; l_brace : '{' opt_nls ; r_brace : '}' opt_nls ; r_paren : ')' ; opt_semi : /* empty */ | semi ; semi : ';' ; comma : ',' opt_nls ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:66.10: warning: empty rule without %empty [-Wempty-rule] input.y:170.10: warning: empty rule without %empty [-Wempty-rule] input.y:175.10: warning: empty rule without %empty [-Wempty-rule] input.y:180.10: warning: empty rule without %empty [-Wempty-rule] input.y:188.10: warning: empty rule without %empty [-Wempty-rule] input.y:202.10: warning: empty rule without %empty [-Wempty-rule] input.y:207.10: warning: empty rule without %empty [-Wempty-rule] input.y:221.10: warning: empty rule without %empty [-Wempty-rule] input.y:300.10: warning: empty rule without %empty [-Wempty-rule] input.y:323.10: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence] input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence] input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence] input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence] input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence] input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence] input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence] input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence] input.y:50.1-5: warning: useless associativity for '\$', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:66.10: warning: empty rule without %empty [-Wempty-rule] input.y:170.10: warning: empty rule without %empty [-Wempty-rule] input.y:175.10: warning: empty rule without %empty [-Wempty-rule] input.y:180.10: warning: empty rule without %empty [-Wempty-rule] input.y:188.10: warning: empty rule without %empty [-Wempty-rule] input.y:202.10: warning: empty rule without %empty [-Wempty-rule] input.y:207.10: warning: empty rule without %empty [-Wempty-rule] input.y:221.10: warning: empty rule without %empty [-Wempty-rule] input.y:300.10: warning: empty rule without %empty [-Wempty-rule] input.y:323.10: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence] input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence] input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence] input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence] input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence] input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence] input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence] input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence] input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:74" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:74" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "319 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed 's/^%define lr.type .*\$//' input.y > input-lalr.y" at_fn_check_prepare_dynamic "sed 's/^%define lr.type .*$//' input.y > input-lalr.y" "existing.at:74" ( $at_check_trace; sed 's/^%define lr.type .*$//' input.y > input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if $DIFF_U_WORKS; then { set +x printf "%s\n" "$at_srcdir/existing.at:74: diff -u input-lalr.output input.output | sed -n '/^@@/,\$p' | sed 's/^ \$//'" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:74" ( $at_check_trace; diff -u input-lalr.output input.output | sed -n '/^@@/,$p' | sed 's/^ $//' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } fi # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "existing.at:74" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:74" { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:74" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:74" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '*', expecting NEWLINE or '{' or ';' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_616 #AT_START_617 at_fn_group_banner 617 'existing.at:74' \ "GNU AWK 3.1.0 Grammar: IELR(1)" " " 24 at_xfail=no ( printf "%s\n" "617. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %define parse.error verbose %token FUNC_CALL NAME REGEXP %token ERROR %token YNUMBER YSTRING %token RELOP APPEND_OP %token ASSIGNOP MATCHOP NEWLINE CONCAT_OP %token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE %token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE %token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION %token LEX_GETLINE LEX_NEXTFILE %token LEX_IN %token LEX_AND LEX_OR INCREMENT DECREMENT %token LEX_BUILTIN LEX_LENGTH /* Lowest to highest */ %right ASSIGNOP %right '?' ':' %left LEX_OR %left LEX_AND %left LEX_GETLINE %nonassoc LEX_IN %left FUNC_CALL LEX_BUILTIN LEX_LENGTH %nonassoc ',' %nonassoc MATCHOP %nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO %left CONCAT_OP %left YSTRING YNUMBER %left '+' '-' %left '*' '/' '%' %right '!' UNARY %right '^' %left INCREMENT DECREMENT %left '$' %left '(' ')' %% start : opt_nls program opt_nls ; program : rule | program rule | error | program error | /* empty */ ; rule : LEX_BEGIN {} action | LEX_END {} action | LEX_BEGIN statement_term | LEX_END statement_term | pattern action | action | pattern statement_term | function_prologue function_body ; func_name : NAME | FUNC_CALL | lex_builtin ; lex_builtin : LEX_BUILTIN | LEX_LENGTH ; function_prologue : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls ; function_body : l_brace statements r_brace opt_semi opt_nls | l_brace r_brace opt_semi opt_nls ; pattern : exp | exp ',' exp ; regexp /* * In this rule, want_regexp tells yylex that the next thing * is a regexp so it should read up to the closing slash. */ : '/' {} REGEXP '/' ; action : l_brace statements r_brace opt_semi opt_nls | l_brace r_brace opt_semi opt_nls ; statements : statement | statements statement | error | statements error ; statement_term : nls | semi opt_nls ; statement : semi opt_nls | l_brace r_brace | l_brace statements r_brace | if_statement | LEX_WHILE '(' exp r_paren opt_nls statement | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement | LEX_BREAK statement_term | LEX_CONTINUE statement_term | print '(' expression_list r_paren output_redir statement_term | print opt_rexpression_list output_redir statement_term | LEX_NEXT statement_term | LEX_NEXTFILE statement_term | LEX_EXIT opt_exp statement_term | LEX_RETURN {} opt_exp statement_term | LEX_DELETE NAME '[' expression_list ']' statement_term | LEX_DELETE NAME statement_term | exp statement_term ; print : LEX_PRINT | LEX_PRINTF ; if_statement : LEX_IF '(' exp r_paren opt_nls statement | LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement ; nls : NEWLINE | nls NEWLINE ; opt_nls : /* empty */ | nls ; input_redir : /* empty */ | '<' simp_exp ; output_redir : /* empty */ | '>' exp | APPEND_OP exp | '|' exp | TWOWAYIO exp ; opt_param_list : /* empty */ | param_list ; param_list : NAME | param_list comma NAME | error | param_list error | param_list comma error ; /* optional expression, as in for loop */ opt_exp : /* empty */ | exp ; opt_rexpression_list : /* empty */ | rexpression_list ; rexpression_list : rexp | rexpression_list comma rexp | error | rexpression_list error | rexpression_list error rexp | rexpression_list comma error ; opt_expression_list : /* empty */ | expression_list ; expression_list : exp | expression_list comma exp | error | expression_list error | expression_list error exp | expression_list comma error ; /* Expressions, not including the comma operator. */ exp : variable ASSIGNOP {} exp | '(' expression_list r_paren LEX_IN NAME | exp '|' LEX_GETLINE opt_variable | exp TWOWAYIO LEX_GETLINE opt_variable | LEX_GETLINE opt_variable input_redir | exp LEX_AND exp | exp LEX_OR exp | exp MATCHOP exp | regexp | '!' regexp %prec UNARY | exp LEX_IN NAME | exp RELOP exp | exp '<' exp | exp '>' exp | exp '?' exp ':' exp | simp_exp | exp simp_exp %prec CONCAT_OP ; rexp : variable ASSIGNOP {} rexp | rexp LEX_AND rexp | rexp LEX_OR rexp | LEX_GETLINE opt_variable input_redir | regexp | '!' regexp %prec UNARY | rexp MATCHOP rexp | rexp LEX_IN NAME | rexp RELOP rexp | rexp '?' rexp ':' rexp | simp_exp | rexp simp_exp %prec CONCAT_OP ; simp_exp : non_post_simp_exp /* Binary operators in order of decreasing precedence. */ | simp_exp '^' simp_exp | simp_exp '*' simp_exp | simp_exp '/' simp_exp | simp_exp '%' simp_exp | simp_exp '+' simp_exp | simp_exp '-' simp_exp | variable INCREMENT | variable DECREMENT ; non_post_simp_exp : '!' simp_exp %prec UNARY | '(' exp r_paren | LEX_BUILTIN '(' opt_expression_list r_paren | LEX_LENGTH '(' opt_expression_list r_paren | LEX_LENGTH | FUNC_CALL '(' opt_expression_list r_paren | variable | INCREMENT variable | DECREMENT variable | YNUMBER | YSTRING | '-' simp_exp %prec UNARY | '+' simp_exp %prec UNARY ; opt_variable : /* empty */ | variable ; variable : NAME | NAME '[' expression_list ']' | '$' non_post_simp_exp ; l_brace : '{' opt_nls ; r_brace : '}' opt_nls ; r_paren : ')' ; opt_semi : /* empty */ | semi ; semi : ';' ; comma : ',' opt_nls ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:66.10: warning: empty rule without %empty [-Wempty-rule] input.y:170.10: warning: empty rule without %empty [-Wempty-rule] input.y:175.10: warning: empty rule without %empty [-Wempty-rule] input.y:180.10: warning: empty rule without %empty [-Wempty-rule] input.y:188.10: warning: empty rule without %empty [-Wempty-rule] input.y:202.10: warning: empty rule without %empty [-Wempty-rule] input.y:207.10: warning: empty rule without %empty [-Wempty-rule] input.y:221.10: warning: empty rule without %empty [-Wempty-rule] input.y:300.10: warning: empty rule without %empty [-Wempty-rule] input.y:323.10: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence] input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence] input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence] input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence] input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence] input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence] input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence] input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence] input.y:50.1-5: warning: useless associativity for '\$', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:66.10: warning: empty rule without %empty [-Wempty-rule] input.y:170.10: warning: empty rule without %empty [-Wempty-rule] input.y:175.10: warning: empty rule without %empty [-Wempty-rule] input.y:180.10: warning: empty rule without %empty [-Wempty-rule] input.y:188.10: warning: empty rule without %empty [-Wempty-rule] input.y:202.10: warning: empty rule without %empty [-Wempty-rule] input.y:207.10: warning: empty rule without %empty [-Wempty-rule] input.y:221.10: warning: empty rule without %empty [-Wempty-rule] input.y:300.10: warning: empty rule without %empty [-Wempty-rule] input.y:323.10: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence] input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence] input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence] input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence] input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence] input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence] input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence] input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence] input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:74" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:74" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "328 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed 's/^%define lr.type .*\$//' input.y > input-lalr.y" at_fn_check_prepare_dynamic "sed 's/^%define lr.type .*$//' input.y > input-lalr.y" "existing.at:74" ( $at_check_trace; sed 's/^%define lr.type .*$//' input.y > input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if $DIFF_U_WORKS; then { set +x printf "%s\n" "$at_srcdir/existing.at:74: diff -u input-lalr.output input.output | sed -n '/^@@/,\$p' | sed 's/^ \$//'" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:74" ( $at_check_trace; diff -u input-lalr.output input.output | sed -n '/^@@/,$p' | sed 's/^ $//' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "@@ -747,7 +747,7 @@ 156 | . '\$' non_post_simp_exp NAME shift, and go to state 9 - '\$' shift, and go to state 24 + '\$' shift, and go to state 320 NAME [reduce using rule 152 (opt_variable)] '\$' [reduce using rule 152 (opt_variable)] @@ -5414,7 +5414,7 @@ 156 | . '\$' non_post_simp_exp NAME shift, and go to state 9 - '\$' shift, and go to state 24 + '\$' shift, and go to state 320 NAME [reduce using rule 152 (opt_variable)] '\$' [reduce using rule 152 (opt_variable)] @@ -5434,7 +5434,7 @@ 156 | . '\$' non_post_simp_exp NAME shift, and go to state 9 - '\$' shift, and go to state 24 + '\$' shift, and go to state 320 NAME [reduce using rule 152 (opt_variable)] '\$' [reduce using rule 152 (opt_variable)] @@ -6249,7 +6249,7 @@ 156 | . '\$' non_post_simp_exp NAME shift, and go to state 9 - '\$' shift, and go to state 24 + '\$' shift, and go to state 320 NAME [reduce using rule 152 (opt_variable)] '\$' [reduce using rule 152 (opt_variable)] @@ -11134,3 +11134,274 @@ 45 statement: LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement . \$default reduce using rule 45 (statement) + + +State 320 + + 139 non_post_simp_exp: . '!' simp_exp + 140 | . '(' exp r_paren + 141 | . LEX_BUILTIN '(' opt_expression_list r_paren + 142 | . LEX_LENGTH '(' opt_expression_list r_paren + 143 | . LEX_LENGTH + 144 | . FUNC_CALL '(' opt_expression_list r_paren + 145 | . variable + 146 | . INCREMENT variable + 147 | . DECREMENT variable + 148 | . YNUMBER + 149 | . YSTRING + 150 | . '-' simp_exp + 151 | . '+' simp_exp + 154 variable: . NAME + 155 | . NAME '[' expression_list ']' + 156 | . '\$' non_post_simp_exp + 156 | '\$' . non_post_simp_exp + + FUNC_CALL shift, and go to state 8 + NAME shift, and go to state 9 + YNUMBER shift, and go to state 10 + YSTRING shift, and go to state 11 + INCREMENT shift, and go to state 321 + DECREMENT shift, and go to state 322 + LEX_BUILTIN shift, and go to state 18 + LEX_LENGTH shift, and go to state 19 + '+' shift, and go to state 323 + '-' shift, and go to state 324 + '!' shift, and go to state 325 + '\$' shift, and go to state 320 + '(' shift, and go to state 55 + + non_post_simp_exp go to state 62 + variable go to state 63 + + +State 321 + + 146 non_post_simp_exp: INCREMENT . variable + 154 variable: . NAME + 155 | . NAME '[' expression_list ']' + 156 | . '\$' non_post_simp_exp + + NAME shift, and go to state 9 + '\$' shift, and go to state 320 + + variable go to state 50 + + +State 322 + + 147 non_post_simp_exp: DECREMENT . variable + 154 variable: . NAME + 155 | . NAME '[' expression_list ']' + 156 | . '\$' non_post_simp_exp + + NAME shift, and go to state 9 + '\$' shift, and go to state 320 + + variable go to state 51 + + +State 323 + + 130 simp_exp: . non_post_simp_exp + 131 | . simp_exp '^' simp_exp + 132 | . simp_exp '*' simp_exp + 133 | . simp_exp '/' simp_exp + 134 | . simp_exp '%' simp_exp + 135 | . simp_exp '+' simp_exp + 136 | . simp_exp '-' simp_exp + 137 | . variable INCREMENT + 138 | . variable DECREMENT + 139 non_post_simp_exp: . '!' simp_exp + 140 | . '(' exp r_paren + 141 | . LEX_BUILTIN '(' opt_expression_list r_paren + 142 | . LEX_LENGTH '(' opt_expression_list r_paren + 143 | . LEX_LENGTH + 144 | . FUNC_CALL '(' opt_expression_list r_paren + 145 | . variable + 146 | . INCREMENT variable + 147 | . DECREMENT variable + 148 | . YNUMBER + 149 | . YSTRING + 150 | . '-' simp_exp + 151 | . '+' simp_exp + 151 | '+' . simp_exp + 154 variable: . NAME + 155 | . NAME '[' expression_list ']' + 156 | . '\$' non_post_simp_exp + + FUNC_CALL shift, and go to state 8 + NAME shift, and go to state 9 + YNUMBER shift, and go to state 10 + YSTRING shift, and go to state 11 + INCREMENT shift, and go to state 16 + DECREMENT shift, and go to state 17 + LEX_BUILTIN shift, and go to state 18 + LEX_LENGTH shift, and go to state 19 + '+' shift, and go to state 20 + '-' shift, and go to state 21 + '!' shift, and go to state 54 + '\$' shift, and go to state 24 + '(' shift, and go to state 55 + + simp_exp go to state 326 + non_post_simp_exp go to state 35 + variable go to state 57 + + +State 324 + + 130 simp_exp: . non_post_simp_exp + 131 | . simp_exp '^' simp_exp + 132 | . simp_exp '*' simp_exp + 133 | . simp_exp '/' simp_exp + 134 | . simp_exp '%' simp_exp + 135 | . simp_exp '+' simp_exp + 136 | . simp_exp '-' simp_exp + 137 | . variable INCREMENT + 138 | . variable DECREMENT + 139 non_post_simp_exp: . '!' simp_exp + 140 | . '(' exp r_paren + 141 | . LEX_BUILTIN '(' opt_expression_list r_paren + 142 | . LEX_LENGTH '(' opt_expression_list r_paren + 143 | . LEX_LENGTH + 144 | . FUNC_CALL '(' opt_expression_list r_paren + 145 | . variable + 146 | . INCREMENT variable + 147 | . DECREMENT variable + 148 | . YNUMBER + 149 | . YSTRING + 150 | . '-' simp_exp + 150 | '-' . simp_exp + 151 | . '+' simp_exp + 154 variable: . NAME + 155 | . NAME '[' expression_list ']' + 156 | . '\$' non_post_simp_exp + + FUNC_CALL shift, and go to state 8 + NAME shift, and go to state 9 + YNUMBER shift, and go to state 10 + YSTRING shift, and go to state 11 + INCREMENT shift, and go to state 16 + DECREMENT shift, and go to state 17 + LEX_BUILTIN shift, and go to state 18 + LEX_LENGTH shift, and go to state 19 + '+' shift, and go to state 20 + '-' shift, and go to state 21 + '!' shift, and go to state 54 + '\$' shift, and go to state 24 + '(' shift, and go to state 55 + + simp_exp go to state 327 + non_post_simp_exp go to state 35 + variable go to state 57 + + +State 325 + + 130 simp_exp: . non_post_simp_exp + 131 | . simp_exp '^' simp_exp + 132 | . simp_exp '*' simp_exp + 133 | . simp_exp '/' simp_exp + 134 | . simp_exp '%' simp_exp + 135 | . simp_exp '+' simp_exp + 136 | . simp_exp '-' simp_exp + 137 | . variable INCREMENT + 138 | . variable DECREMENT + 139 non_post_simp_exp: . '!' simp_exp + 139 | '!' . simp_exp + 140 | . '(' exp r_paren + 141 | . LEX_BUILTIN '(' opt_expression_list r_paren + 142 | . LEX_LENGTH '(' opt_expression_list r_paren + 143 | . LEX_LENGTH + 144 | . FUNC_CALL '(' opt_expression_list r_paren + 145 | . variable + 146 | . INCREMENT variable + 147 | . DECREMENT variable + 148 | . YNUMBER + 149 | . YSTRING + 150 | . '-' simp_exp + 151 | . '+' simp_exp + 154 variable: . NAME + 155 | . NAME '[' expression_list ']' + 156 | . '\$' non_post_simp_exp + + FUNC_CALL shift, and go to state 8 + NAME shift, and go to state 9 + YNUMBER shift, and go to state 10 + YSTRING shift, and go to state 11 + INCREMENT shift, and go to state 16 + DECREMENT shift, and go to state 17 + LEX_BUILTIN shift, and go to state 18 + LEX_LENGTH shift, and go to state 19 + '+' shift, and go to state 20 + '-' shift, and go to state 21 + '!' shift, and go to state 54 + '\$' shift, and go to state 24 + '(' shift, and go to state 55 + + simp_exp go to state 328 + non_post_simp_exp go to state 35 + variable go to state 57 + + +State 326 + + 131 simp_exp: simp_exp . '^' simp_exp + 132 | simp_exp . '*' simp_exp + 133 | simp_exp . '/' simp_exp + 134 | simp_exp . '%' simp_exp + 135 | simp_exp . '+' simp_exp + 136 | simp_exp . '-' simp_exp + 151 non_post_simp_exp: '+' simp_exp . [error, FUNC_CALL, NAME, YNUMBER, YSTRING, RELOP, APPEND_OP, MATCHOP, NEWLINE, LEX_IN, LEX_AND, LEX_OR, INCREMENT, DECREMENT, LEX_BUILTIN, LEX_LENGTH, '?', ':', ',', '<', '>', '|', TWOWAYIO, '+', '-', '!', '\$', '(', ')', ']', '{', ';'] + + '*' shift, and go to state 89 + '/' shift, and go to state 90 + '%' shift, and go to state 91 + '^' shift, and go to state 92 + + \$default reduce using rule 151 (non_post_simp_exp) + + Conflict between rule 151 and token '+' resolved as reduce ('+' < UNARY). + Conflict between rule 151 and token '-' resolved as reduce ('-' < UNARY). + + +State 327 + + 131 simp_exp: simp_exp . '^' simp_exp + 132 | simp_exp . '*' simp_exp + 133 | simp_exp . '/' simp_exp + 134 | simp_exp . '%' simp_exp + 135 | simp_exp . '+' simp_exp + 136 | simp_exp . '-' simp_exp + 150 non_post_simp_exp: '-' simp_exp . [error, FUNC_CALL, NAME, YNUMBER, YSTRING, RELOP, APPEND_OP, MATCHOP, NEWLINE, LEX_IN, LEX_AND, LEX_OR, INCREMENT, DECREMENT, LEX_BUILTIN, LEX_LENGTH, '?', ':', ',', '<', '>', '|', TWOWAYIO, '+', '-', '!', '\$', '(', ')', ']', '{', ';'] + + '*' shift, and go to state 89 + '/' shift, and go to state 90 + '%' shift, and go to state 91 + '^' shift, and go to state 92 + + \$default reduce using rule 150 (non_post_simp_exp) + + Conflict between rule 150 and token '+' resolved as reduce ('+' < UNARY). + Conflict between rule 150 and token '-' resolved as reduce ('-' < UNARY). + + +State 328 + + 131 simp_exp: simp_exp . '^' simp_exp + 132 | simp_exp . '*' simp_exp + 133 | simp_exp . '/' simp_exp + 134 | simp_exp . '%' simp_exp + 135 | simp_exp . '+' simp_exp + 136 | simp_exp . '-' simp_exp + 139 non_post_simp_exp: '!' simp_exp . [error, FUNC_CALL, NAME, YNUMBER, YSTRING, RELOP, APPEND_OP, MATCHOP, NEWLINE, LEX_IN, LEX_AND, LEX_OR, INCREMENT, DECREMENT, LEX_BUILTIN, LEX_LENGTH, '?', ':', ',', '<', '>', '|', TWOWAYIO, '+', '-', '!', '\$', '(', ')', ']', '{', ';'] + + '*' shift, and go to state 89 + '/' shift, and go to state 90 + '%' shift, and go to state 91 + '^' shift, and go to state 92 + + \$default reduce using rule 139 (non_post_simp_exp) + + Conflict between rule 139 and token '+' resolved as reduce ('+' < UNARY). + Conflict between rule 139 and token '-' resolved as reduce ('-' < UNARY). " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } fi # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "existing.at:74" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:74" { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:74" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:74" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_617 #AT_START_618 at_fn_group_banner 618 'existing.at:74' \ "GNU AWK 3.1.0 Grammar: Canonical LR(1)" " " 24 at_xfail=no ( printf "%s\n" "618. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %define parse.error verbose %token FUNC_CALL NAME REGEXP %token ERROR %token YNUMBER YSTRING %token RELOP APPEND_OP %token ASSIGNOP MATCHOP NEWLINE CONCAT_OP %token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE %token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE %token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION %token LEX_GETLINE LEX_NEXTFILE %token LEX_IN %token LEX_AND LEX_OR INCREMENT DECREMENT %token LEX_BUILTIN LEX_LENGTH /* Lowest to highest */ %right ASSIGNOP %right '?' ':' %left LEX_OR %left LEX_AND %left LEX_GETLINE %nonassoc LEX_IN %left FUNC_CALL LEX_BUILTIN LEX_LENGTH %nonassoc ',' %nonassoc MATCHOP %nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO %left CONCAT_OP %left YSTRING YNUMBER %left '+' '-' %left '*' '/' '%' %right '!' UNARY %right '^' %left INCREMENT DECREMENT %left '$' %left '(' ')' %% start : opt_nls program opt_nls ; program : rule | program rule | error | program error | /* empty */ ; rule : LEX_BEGIN {} action | LEX_END {} action | LEX_BEGIN statement_term | LEX_END statement_term | pattern action | action | pattern statement_term | function_prologue function_body ; func_name : NAME | FUNC_CALL | lex_builtin ; lex_builtin : LEX_BUILTIN | LEX_LENGTH ; function_prologue : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls ; function_body : l_brace statements r_brace opt_semi opt_nls | l_brace r_brace opt_semi opt_nls ; pattern : exp | exp ',' exp ; regexp /* * In this rule, want_regexp tells yylex that the next thing * is a regexp so it should read up to the closing slash. */ : '/' {} REGEXP '/' ; action : l_brace statements r_brace opt_semi opt_nls | l_brace r_brace opt_semi opt_nls ; statements : statement | statements statement | error | statements error ; statement_term : nls | semi opt_nls ; statement : semi opt_nls | l_brace r_brace | l_brace statements r_brace | if_statement | LEX_WHILE '(' exp r_paren opt_nls statement | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement | LEX_BREAK statement_term | LEX_CONTINUE statement_term | print '(' expression_list r_paren output_redir statement_term | print opt_rexpression_list output_redir statement_term | LEX_NEXT statement_term | LEX_NEXTFILE statement_term | LEX_EXIT opt_exp statement_term | LEX_RETURN {} opt_exp statement_term | LEX_DELETE NAME '[' expression_list ']' statement_term | LEX_DELETE NAME statement_term | exp statement_term ; print : LEX_PRINT | LEX_PRINTF ; if_statement : LEX_IF '(' exp r_paren opt_nls statement | LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement ; nls : NEWLINE | nls NEWLINE ; opt_nls : /* empty */ | nls ; input_redir : /* empty */ | '<' simp_exp ; output_redir : /* empty */ | '>' exp | APPEND_OP exp | '|' exp | TWOWAYIO exp ; opt_param_list : /* empty */ | param_list ; param_list : NAME | param_list comma NAME | error | param_list error | param_list comma error ; /* optional expression, as in for loop */ opt_exp : /* empty */ | exp ; opt_rexpression_list : /* empty */ | rexpression_list ; rexpression_list : rexp | rexpression_list comma rexp | error | rexpression_list error | rexpression_list error rexp | rexpression_list comma error ; opt_expression_list : /* empty */ | expression_list ; expression_list : exp | expression_list comma exp | error | expression_list error | expression_list error exp | expression_list comma error ; /* Expressions, not including the comma operator. */ exp : variable ASSIGNOP {} exp | '(' expression_list r_paren LEX_IN NAME | exp '|' LEX_GETLINE opt_variable | exp TWOWAYIO LEX_GETLINE opt_variable | LEX_GETLINE opt_variable input_redir | exp LEX_AND exp | exp LEX_OR exp | exp MATCHOP exp | regexp | '!' regexp %prec UNARY | exp LEX_IN NAME | exp RELOP exp | exp '<' exp | exp '>' exp | exp '?' exp ':' exp | simp_exp | exp simp_exp %prec CONCAT_OP ; rexp : variable ASSIGNOP {} rexp | rexp LEX_AND rexp | rexp LEX_OR rexp | LEX_GETLINE opt_variable input_redir | regexp | '!' regexp %prec UNARY | rexp MATCHOP rexp | rexp LEX_IN NAME | rexp RELOP rexp | rexp '?' rexp ':' rexp | simp_exp | rexp simp_exp %prec CONCAT_OP ; simp_exp : non_post_simp_exp /* Binary operators in order of decreasing precedence. */ | simp_exp '^' simp_exp | simp_exp '*' simp_exp | simp_exp '/' simp_exp | simp_exp '%' simp_exp | simp_exp '+' simp_exp | simp_exp '-' simp_exp | variable INCREMENT | variable DECREMENT ; non_post_simp_exp : '!' simp_exp %prec UNARY | '(' exp r_paren | LEX_BUILTIN '(' opt_expression_list r_paren | LEX_LENGTH '(' opt_expression_list r_paren | LEX_LENGTH | FUNC_CALL '(' opt_expression_list r_paren | variable | INCREMENT variable | DECREMENT variable | YNUMBER | YSTRING | '-' simp_exp %prec UNARY | '+' simp_exp %prec UNARY ; opt_variable : /* empty */ | variable ; variable : NAME | NAME '[' expression_list ']' | '$' non_post_simp_exp ; l_brace : '{' opt_nls ; r_brace : '}' opt_nls ; r_paren : ')' ; opt_semi : /* empty */ | semi ; semi : ';' ; comma : ',' opt_nls ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';', 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:66.10: warning: empty rule without %empty [-Wempty-rule] input.y:170.10: warning: empty rule without %empty [-Wempty-rule] input.y:175.10: warning: empty rule without %empty [-Wempty-rule] input.y:180.10: warning: empty rule without %empty [-Wempty-rule] input.y:188.10: warning: empty rule without %empty [-Wempty-rule] input.y:202.10: warning: empty rule without %empty [-Wempty-rule] input.y:207.10: warning: empty rule without %empty [-Wempty-rule] input.y:221.10: warning: empty rule without %empty [-Wempty-rule] input.y:300.10: warning: empty rule without %empty [-Wempty-rule] input.y:323.10: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence] input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence] input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence] input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence] input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence] input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence] input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence] input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence] input.y:50.1-5: warning: useless associativity for '\$', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:66.10: warning: empty rule without %empty [-Wempty-rule] input.y:170.10: warning: empty rule without %empty [-Wempty-rule] input.y:175.10: warning: empty rule without %empty [-Wempty-rule] input.y:180.10: warning: empty rule without %empty [-Wempty-rule] input.y:188.10: warning: empty rule without %empty [-Wempty-rule] input.y:202.10: warning: empty rule without %empty [-Wempty-rule] input.y:207.10: warning: empty rule without %empty [-Wempty-rule] input.y:221.10: warning: empty rule without %empty [-Wempty-rule] input.y:300.10: warning: empty rule without %empty [-Wempty-rule] input.y:323.10: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence] input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence] input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence] input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence] input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence] input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence] input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence] input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence] input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence] input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence] input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence] input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:74" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:74" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2358 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "existing.at:74" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:74" { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:74" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:74" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:74: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:74" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:74" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_618 #AT_START_619 at_fn_group_banner 619 'existing.at:808' \ "GNU Cim Grammar: LALR(1)" " " 24 at_xfail=no ( printf "%s\n" "619. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %token HACTIVATE HAFTER /*HAND*/ HARRAY HAT HBEFORE HBEGIN HBOOLEAN HCHARACTER HCLASS /*HCOMMENT*/ HCONC HDELAY HDO HELSE HEND HEQ /*HEQV*/ HEXTERNAL HFOR HGE HGO HGOTO HGT HHIDDEN HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS HLABEL HLE HLONG HLT HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT /*HOR*/ HOTHERWISE HPRIOR HPROCEDURE HPROTECTED HQUA HREACTIVATE HREAL HREF HSHORT HSTEP HSWITCH HTEXT HTHEN HTHIS HTO HUNTIL HVALUE HVAR HVIRTUAL HWHEN HWHILE HASSIGNVALUE HASSIGNREF /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR HBEGPAR HENDPAR HEQR HNER HADD HSUB HMUL HDIV HINTDIV HEXP HDOTDOTDOT %token HIDENTIFIER %token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST %token HREALKONST %token HTEXTKONST %right HASSIGN %left HORELSE %left HANDTHEN %left HEQV %left HIMP %left HOR %left HAND %left HNOT %left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR %left HCONC %left HTERMOPERATOR %left UNEAR %left HFACTOROPERATOR %left HPRIMARYOPERATOR %left HQUA %left HDOT %start MAIN_MODULE %% /* GRAMATIKK FOR PROGRAM MODULES */ MAIN_MODULE : {} MODULS | error HSTATEMENTSEPARATOR MBEE_DECLSTMS ; EXT_DECLARATION : HEXTERNAL MBEE_TYPE HPROCEDURE {} EXT_LIST | HEXTERNAL HIDENTIFIER HPROCEDURE {} HIDENTIFIER {} EXTERNAL_KIND_ITEM | HEXTERNAL HCLASS {} EXT_LIST ; EXTERNAL_KIND_ITEM: EXT_IDENT HOBJRELOPERATOR {} MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING EMPTY_BLOCK {} /* | EXT_IDENT {} MBEE_REST_EXT_LIST ; MBEE_REST_EXT_LIST: /* EMPTY | HPAREXPSEPARATOR EXT_KIND_LIST ; EXT_KIND_LIST : EXT_KIND_ITEM | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM ; EXT_KIND_ITEM : HIDENTIFIER EXT_IDENT {}*/ ; EMPTY_BLOCK : /*EMPT*/ | HBEGIN HEND ; EXT_LIST : EXT_ITEM | EXT_LIST HPAREXPSEPARATOR EXT_ITEM ; EXT_ITEM : HIDENTIFIER EXT_IDENT ; EXT_IDENT : /* EMPTY */ | HVALRELOPERATOR {} HTEXTKONST ; /* GRAMATIKK FOR TYPER */ NO_TYPE : /*EMPT*/ ; MBEE_TYPE : NO_TYPE | TYPE ; TYPE : HREF HBEGPAR HIDENTIFIER {} HENDPAR | HTEXT | HBOOLEAN | HCHARACTER | HSHORT HINTEGER | HINTEGER | HREAL | HLONG HREAL ; /* GRAMATIKK FOR DEL AV SETNINGER */ MBEE_ELSE_PART : /*EMPT*/ /* | HELSE HIF EXPRESSION HTHEN {} BLOCK {} MBEE_ELSE_PART {}*/ | HELSE {} BLOCK ; FOR_LIST : FOR_LIST_ELEMENT | FOR_LIST_ELEMENT HPAREXPSEPARATOR FOR_LIST ; FOR_LIST_ELEMENT: EXPRESSION MBEE_F_L_EL_R_PT ; MBEE_F_L_EL_R_PT: /*EMPT*/ | HWHILE EXPRESSION | HSTEP EXPRESSION HUNTIL EXPRESSION ; GOTO : HGO HTO | HGOTO ; CONN_STATE_R_PT : WHEN_CLAUSE_LIST | HDO {} BLOCK ; WHEN_CLAUSE_LIST: HWHEN HIDENTIFIER HDO {} BLOCK | WHEN_CLAUSE_LIST HWHEN HIDENTIFIER HDO {} BLOCK ; MBEE_OTWI_CLAUS : /*EMPT*/ | HOTHERWISE {} BLOCK ; ACTIVATOR : HACTIVATE | HREACTIVATE ; SCHEDULE : /*EMPT*/ | ATDELAY EXPRESSION {} PRIOR | BEFOREAFTER {} EXPRESSION ; ATDELAY : HAT | HDELAY ; BEFOREAFTER : HBEFORE | HAFTER ; PRIOR : /*EMPT*/ | HPRIOR ; /* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ MODULSTATEMENT : HWHILE EXPRESSION HDO {} BLOCK | HIF EXPRESSION HTHEN {} BLOCK {} MBEE_ELSE_PART | HFOR HIDENTIFIER HASSIGN {} FOR_LIST HDO {} BLOCK | GOTO EXPRESSION | HINSPECT EXPRESSION {} CONN_STATE_R_PT {} MBEE_OTWI_CLAUS | HINNER | HIDENTIFIER HLABELSEPARATOR {} DECLSTATEMENT | EXPRESSION_SIMP HBEGIN {} IMPORT_SPEC_MODULE {} MBEE_DECLSTMS HEND | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND | EXPRESSION_SIMP HBEGIN error HEND | EXPRESSION_SIMP | ACTIVATOR EXPRESSION SCHEDULE | HBEGIN {} MBEE_DECLSTMS HEND | MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING BLOCK | HIDENTIFIER HCLASS NO_TYPE {} IMPORT_SPEC_MODULE HIDENTIFIER {} HEADING BLOCK | HCLASS NO_TYPE HIDENTIFIER {} HEADING BLOCK | EXT_DECLARATION | /*EMPT*/ ; IMPORT_SPEC_MODULE: ; DECLSTATEMENT : MODULSTATEMENT | TYPE HIDENTIFIER MBEE_CONSTANT HPAREXPSEPARATOR {} IDENTIFIER_LISTC | TYPE HIDENTIFIER MBEE_CONSTANT | MBEE_TYPE HARRAY {} ARR_SEGMENT_LIST | HSWITCH HIDENTIFIER HASSIGN {} SWITCH_LIST ; BLOCK : DECLSTATEMENT | HBEGIN MBEE_DECLSTMS HEND | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND | HBEGIN error HEND ; MBEE_DECLSTMS : MBEE_DECLSTMSU ; MBEE_DECLSTMSU : DECLSTATEMENT | MBEE_DECLSTMSU HSTATEMENTSEPARATOR DECLSTATEMENT ; MODULS : MODULSTATEMENT | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT ; /* GRAMATIKK FOR DEL AV DEKLARASJONER */ ARR_SEGMENT_LIST: ARR_SEGMENT | ARR_SEGMENT_LIST HPAREXPSEPARATOR ARR_SEGMENT ; ARR_SEGMENT : ARRAY_SEGMENT HBEGPAR BAUND_PAIR_LIST HENDPAR ; ARRAY_SEGMENT : ARRAY_SEGMENT_EL {} | ARRAY_SEGMENT_EL HPAREXPSEPARATOR ARRAY_SEGMENT ; ARRAY_SEGMENT_EL: HIDENTIFIER ; BAUND_PAIR_LIST : BAUND_PAIR | BAUND_PAIR HPAREXPSEPARATOR BAUND_PAIR_LIST ; BAUND_PAIR : EXPRESSION HLABELSEPARATOR EXPRESSION ; SWITCH_LIST : EXPRESSION | EXPRESSION HPAREXPSEPARATOR SWITCH_LIST ; HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {} MBEE_MODE_PART {} MBEE_SPEC_PART {} MBEE_PROT_PART {} MBEE_VIRT_PART ; MBEE_FMAL_PAR_P : /*EMPT*/ | FMAL_PAR_PART ; FMAL_PAR_PART : HBEGPAR NO_TYPE MBEE_LISTV HENDPAR ; MBEE_LISTV : /*EMPT*/ | LISTV ; LISTV : HIDENTIFIER | FPP_CATEG HDOTDOTDOT | HIDENTIFIER {} HPAREXPSEPARATOR LISTV | FPP_SPEC | FPP_SPEC HPAREXPSEPARATOR LISTV ; FPP_HEADING : HBEGPAR NO_TYPE FPP_MBEE_LISTV HENDPAR ; FPP_MBEE_LISTV : /*EMPT*/ | FPP_LISTV ; FPP_LISTV : FPP_CATEG HDOTDOTDOT | FPP_SPEC | FPP_SPEC HPAREXPSEPARATOR LISTV ; FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER | FPP_CATEG FPP_PROC_DECL_IN_SPEC ; FPP_CATEG : HNAME HLABELSEPARATOR | HVALUE HLABELSEPARATOR | HVAR HLABELSEPARATOR | /*EMPT*/ ; FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE HIDENTIFIER {} FPP_HEADING {} { /* Yes, two "final" actions. */ } ; IDENTIFIER_LISTV: HIDENTIFIER | HDOTDOTDOT | HIDENTIFIER {} HPAREXPSEPARATOR IDENTIFIER_LISTV ; MBEE_MODE_PART : /*EMPT*/ | MODE_PART ; MODE_PART : NAME_PART | VALUE_PART | VAR_PART | NAME_PART VALUE_PART | VALUE_PART NAME_PART | NAME_PART VAR_PART | VAR_PART NAME_PART | VALUE_PART VAR_PART | VAR_PART VALUE_PART | VAR_PART NAME_PART VALUE_PART | NAME_PART VAR_PART VALUE_PART | NAME_PART VALUE_PART VAR_PART | VAR_PART VALUE_PART NAME_PART | VALUE_PART VAR_PART NAME_PART | VALUE_PART NAME_PART VAR_PART ; NAME_PART : HNAME {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; VAR_PART : HVAR {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; VALUE_PART : HVALUE {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; MBEE_SPEC_PART : /*EMPT*/ | SPEC_PART ; SPEC_PART : ONE_SPEC | SPEC_PART ONE_SPEC ; ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR {} PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR IDENTIFIER_LIST HSTATEMENTSEPARATOR ; SPECIFIER : TYPE | MBEE_TYPE HARRAY | HLABEL | HSWITCH ; PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING {} MBEE_BEGIN_END ; MBEE_BEGIN_END : /* EMPTY */ | HBEGIN HEND ; MBEE_PROT_PART : /*EMPT*/ | PROTECTION_PART ; PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR | PROTECTION_PART PROT_SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR ; PROT_SPECIFIER : HHIDDEN | HPROTECTED | HHIDDEN HPROTECTED | HPROTECTED HHIDDEN ; MBEE_VIRT_PART : /*EMPT*/ | VIRTUAL_PART ; VIRTUAL_PART : HVIRTUAL HLABELSEPARATOR MBEE_SPEC_PART ; IDENTIFIER_LIST : HIDENTIFIER | IDENTIFIER_LIST HPAREXPSEPARATOR HIDENTIFIER ; IDENTIFIER_LISTC: HIDENTIFIER MBEE_CONSTANT | IDENTIFIER_LISTC HPAREXPSEPARATOR HIDENTIFIER MBEE_CONSTANT ; MBEE_CONSTANT : /* EMPTY */ | HVALRELOPERATOR {} EXPRESSION ; /* GRAMATIKK FOR UTTRYKK */ EXPRESSION : EXPRESSION_SIMP | HIF EXPRESSION HTHEN EXPRESSION HELSE EXPRESSION ; EXPRESSION_SIMP : EXPRESSION_SIMP HASSIGN EXPRESSION | EXPRESSION_SIMP HCONC EXPRESSION_SIMP | EXPRESSION_SIMP HOR HELSE EXPRESSION_SIMP %prec HORELSE | EXPRESSION_SIMP HAND HTHEN EXPRESSION_SIMP %prec HANDTHEN | EXPRESSION_SIMP HEQV EXPRESSION_SIMP | EXPRESSION_SIMP HIMP EXPRESSION_SIMP | EXPRESSION_SIMP HOR EXPRESSION_SIMP | EXPRESSION_SIMP HAND EXPRESSION_SIMP | HNOT EXPRESSION_SIMP | EXPRESSION_SIMP HVALRELOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HREFRELOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HOBJRELOPERATOR EXPRESSION_SIMP | HTERMOPERATOR EXPRESSION_SIMP %prec UNEAR | EXPRESSION_SIMP HTERMOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HFACTOROPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HPRIMARYOPERATOR EXPRESSION_SIMP | HBEGPAR EXPRESSION HENDPAR | HTEXTKONST | HCHARACTERKONST | HREALKONST | HINTEGERKONST | HBOOLEANKONST | HNONE | HIDENTIFIER {} MBEE_ARG_R_PT | HTHIS HIDENTIFIER | HNEW HIDENTIFIER ARG_R_PT | EXPRESSION_SIMP HDOT EXPRESSION_SIMP | EXPRESSION_SIMP HQUA HIDENTIFIER ; ARG_R_PT : /*EMPTY*/ | HBEGPAR ARGUMENT_LIST HENDPAR ; MBEE_ARG_R_PT : /*EMPTY*/ | HBEGPAR ARGUMENT_LIST HENDPAR ; ARGUMENT_LIST : EXPRESSION | EXPRESSION HPAREXPSEPARATOR ARGUMENT_LIST ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:128.18: warning: empty rule without %empty [-Wempty-rule] input.y:137.18: warning: empty rule without %empty [-Wempty-rule] input.y:142.18: warning: empty rule without %empty [-Wempty-rule] input.y:161.18: warning: empty rule without %empty [-Wempty-rule] input.y:179.18: warning: empty rule without %empty [-Wempty-rule] input.y:205.18: warning: empty rule without %empty [-Wempty-rule] input.y:213.18: warning: empty rule without %empty [-Wempty-rule] input.y:225.18: warning: empty rule without %empty [-Wempty-rule] input.y:292.18: warning: empty rule without %empty [-Wempty-rule] input.y:294.20: warning: empty rule without %empty [-Wempty-rule] input.y:367.18: warning: empty rule without %empty [-Wempty-rule] input.y:373.18: warning: empty rule without %empty [-Wempty-rule] input.y:387.18: warning: empty rule without %empty [-Wempty-rule] input.y:401.18: warning: empty rule without %empty [-Wempty-rule] input.y:413.18: warning: empty rule without %empty [-Wempty-rule] input.y:443.18: warning: empty rule without %empty [-Wempty-rule] input.y:471.18: warning: empty rule without %empty [-Wempty-rule] input.y:474.18: warning: empty rule without %empty [-Wempty-rule] input.y:489.18: warning: empty rule without %empty [-Wempty-rule] input.y:506.18: warning: empty rule without %empty [-Wempty-rule] input.y:587.18: warning: empty rule without %empty [-Wempty-rule] input.y:591.18: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence] input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence] input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence] input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence] input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence] input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:128.18: warning: empty rule without %empty [-Wempty-rule] input.y:137.18: warning: empty rule without %empty [-Wempty-rule] input.y:142.18: warning: empty rule without %empty [-Wempty-rule] input.y:161.18: warning: empty rule without %empty [-Wempty-rule] input.y:179.18: warning: empty rule without %empty [-Wempty-rule] input.y:205.18: warning: empty rule without %empty [-Wempty-rule] input.y:213.18: warning: empty rule without %empty [-Wempty-rule] input.y:225.18: warning: empty rule without %empty [-Wempty-rule] input.y:292.18: warning: empty rule without %empty [-Wempty-rule] input.y:294.20: warning: empty rule without %empty [-Wempty-rule] input.y:367.18: warning: empty rule without %empty [-Wempty-rule] input.y:373.18: warning: empty rule without %empty [-Wempty-rule] input.y:387.18: warning: empty rule without %empty [-Wempty-rule] input.y:401.18: warning: empty rule without %empty [-Wempty-rule] input.y:413.18: warning: empty rule without %empty [-Wempty-rule] input.y:443.18: warning: empty rule without %empty [-Wempty-rule] input.y:471.18: warning: empty rule without %empty [-Wempty-rule] input.y:474.18: warning: empty rule without %empty [-Wempty-rule] input.y:489.18: warning: empty rule without %empty [-Wempty-rule] input.y:506.18: warning: empty rule without %empty [-Wempty-rule] input.y:587.18: warning: empty rule without %empty [-Wempty-rule] input.y:591.18: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence] input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence] input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence] input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence] input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence] input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:808" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:808" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "442 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed 's/^%define lr.type .*\$//' input.y > input-lalr.y" at_fn_check_prepare_dynamic "sed 's/^%define lr.type .*$//' input.y > input-lalr.y" "existing.at:808" ( $at_check_trace; sed 's/^%define lr.type .*$//' input.y > input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if $DIFF_U_WORKS; then { set +x printf "%s\n" "$at_srcdir/existing.at:808: diff -u input-lalr.output input.output | sed -n '/^@@/,\$p' | sed 's/^ \$//'" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:808" ( $at_check_trace; diff -u input-lalr.output input.output | sed -n '/^@@/,$p' | sed 's/^ $//' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: grep '^State.*conflicts:' input.output" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; grep '^State.*conflicts:' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 64 conflicts: 14 shift/reduce State 164 conflicts: 1 shift/reduce State 201 conflicts: 33 shift/reduce, 4 reduce/reduce State 206 conflicts: 1 shift/reduce State 240 conflicts: 1 shift/reduce State 335 conflicts: 9 shift/reduce, 2 reduce/reduce State 356 conflicts: 1 shift/reduce State 360 conflicts: 9 shift/reduce, 2 reduce/reduce State 427 conflicts: 9 shift/reduce, 2 reduce/reduce " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "existing.at:808" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:808" { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:808" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:808" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_619 #AT_START_620 at_fn_group_banner 620 'existing.at:808' \ "GNU Cim Grammar: IELR(1)" " " 24 at_xfail=no ( printf "%s\n" "620. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %token HACTIVATE HAFTER /*HAND*/ HARRAY HAT HBEFORE HBEGIN HBOOLEAN HCHARACTER HCLASS /*HCOMMENT*/ HCONC HDELAY HDO HELSE HEND HEQ /*HEQV*/ HEXTERNAL HFOR HGE HGO HGOTO HGT HHIDDEN HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS HLABEL HLE HLONG HLT HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT /*HOR*/ HOTHERWISE HPRIOR HPROCEDURE HPROTECTED HQUA HREACTIVATE HREAL HREF HSHORT HSTEP HSWITCH HTEXT HTHEN HTHIS HTO HUNTIL HVALUE HVAR HVIRTUAL HWHEN HWHILE HASSIGNVALUE HASSIGNREF /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR HBEGPAR HENDPAR HEQR HNER HADD HSUB HMUL HDIV HINTDIV HEXP HDOTDOTDOT %token HIDENTIFIER %token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST %token HREALKONST %token HTEXTKONST %right HASSIGN %left HORELSE %left HANDTHEN %left HEQV %left HIMP %left HOR %left HAND %left HNOT %left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR %left HCONC %left HTERMOPERATOR %left UNEAR %left HFACTOROPERATOR %left HPRIMARYOPERATOR %left HQUA %left HDOT %start MAIN_MODULE %% /* GRAMATIKK FOR PROGRAM MODULES */ MAIN_MODULE : {} MODULS | error HSTATEMENTSEPARATOR MBEE_DECLSTMS ; EXT_DECLARATION : HEXTERNAL MBEE_TYPE HPROCEDURE {} EXT_LIST | HEXTERNAL HIDENTIFIER HPROCEDURE {} HIDENTIFIER {} EXTERNAL_KIND_ITEM | HEXTERNAL HCLASS {} EXT_LIST ; EXTERNAL_KIND_ITEM: EXT_IDENT HOBJRELOPERATOR {} MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING EMPTY_BLOCK {} /* | EXT_IDENT {} MBEE_REST_EXT_LIST ; MBEE_REST_EXT_LIST: /* EMPTY | HPAREXPSEPARATOR EXT_KIND_LIST ; EXT_KIND_LIST : EXT_KIND_ITEM | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM ; EXT_KIND_ITEM : HIDENTIFIER EXT_IDENT {}*/ ; EMPTY_BLOCK : /*EMPT*/ | HBEGIN HEND ; EXT_LIST : EXT_ITEM | EXT_LIST HPAREXPSEPARATOR EXT_ITEM ; EXT_ITEM : HIDENTIFIER EXT_IDENT ; EXT_IDENT : /* EMPTY */ | HVALRELOPERATOR {} HTEXTKONST ; /* GRAMATIKK FOR TYPER */ NO_TYPE : /*EMPT*/ ; MBEE_TYPE : NO_TYPE | TYPE ; TYPE : HREF HBEGPAR HIDENTIFIER {} HENDPAR | HTEXT | HBOOLEAN | HCHARACTER | HSHORT HINTEGER | HINTEGER | HREAL | HLONG HREAL ; /* GRAMATIKK FOR DEL AV SETNINGER */ MBEE_ELSE_PART : /*EMPT*/ /* | HELSE HIF EXPRESSION HTHEN {} BLOCK {} MBEE_ELSE_PART {}*/ | HELSE {} BLOCK ; FOR_LIST : FOR_LIST_ELEMENT | FOR_LIST_ELEMENT HPAREXPSEPARATOR FOR_LIST ; FOR_LIST_ELEMENT: EXPRESSION MBEE_F_L_EL_R_PT ; MBEE_F_L_EL_R_PT: /*EMPT*/ | HWHILE EXPRESSION | HSTEP EXPRESSION HUNTIL EXPRESSION ; GOTO : HGO HTO | HGOTO ; CONN_STATE_R_PT : WHEN_CLAUSE_LIST | HDO {} BLOCK ; WHEN_CLAUSE_LIST: HWHEN HIDENTIFIER HDO {} BLOCK | WHEN_CLAUSE_LIST HWHEN HIDENTIFIER HDO {} BLOCK ; MBEE_OTWI_CLAUS : /*EMPT*/ | HOTHERWISE {} BLOCK ; ACTIVATOR : HACTIVATE | HREACTIVATE ; SCHEDULE : /*EMPT*/ | ATDELAY EXPRESSION {} PRIOR | BEFOREAFTER {} EXPRESSION ; ATDELAY : HAT | HDELAY ; BEFOREAFTER : HBEFORE | HAFTER ; PRIOR : /*EMPT*/ | HPRIOR ; /* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ MODULSTATEMENT : HWHILE EXPRESSION HDO {} BLOCK | HIF EXPRESSION HTHEN {} BLOCK {} MBEE_ELSE_PART | HFOR HIDENTIFIER HASSIGN {} FOR_LIST HDO {} BLOCK | GOTO EXPRESSION | HINSPECT EXPRESSION {} CONN_STATE_R_PT {} MBEE_OTWI_CLAUS | HINNER | HIDENTIFIER HLABELSEPARATOR {} DECLSTATEMENT | EXPRESSION_SIMP HBEGIN {} IMPORT_SPEC_MODULE {} MBEE_DECLSTMS HEND | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND | EXPRESSION_SIMP HBEGIN error HEND | EXPRESSION_SIMP | ACTIVATOR EXPRESSION SCHEDULE | HBEGIN {} MBEE_DECLSTMS HEND | MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING BLOCK | HIDENTIFIER HCLASS NO_TYPE {} IMPORT_SPEC_MODULE HIDENTIFIER {} HEADING BLOCK | HCLASS NO_TYPE HIDENTIFIER {} HEADING BLOCK | EXT_DECLARATION | /*EMPT*/ ; IMPORT_SPEC_MODULE: ; DECLSTATEMENT : MODULSTATEMENT | TYPE HIDENTIFIER MBEE_CONSTANT HPAREXPSEPARATOR {} IDENTIFIER_LISTC | TYPE HIDENTIFIER MBEE_CONSTANT | MBEE_TYPE HARRAY {} ARR_SEGMENT_LIST | HSWITCH HIDENTIFIER HASSIGN {} SWITCH_LIST ; BLOCK : DECLSTATEMENT | HBEGIN MBEE_DECLSTMS HEND | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND | HBEGIN error HEND ; MBEE_DECLSTMS : MBEE_DECLSTMSU ; MBEE_DECLSTMSU : DECLSTATEMENT | MBEE_DECLSTMSU HSTATEMENTSEPARATOR DECLSTATEMENT ; MODULS : MODULSTATEMENT | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT ; /* GRAMATIKK FOR DEL AV DEKLARASJONER */ ARR_SEGMENT_LIST: ARR_SEGMENT | ARR_SEGMENT_LIST HPAREXPSEPARATOR ARR_SEGMENT ; ARR_SEGMENT : ARRAY_SEGMENT HBEGPAR BAUND_PAIR_LIST HENDPAR ; ARRAY_SEGMENT : ARRAY_SEGMENT_EL {} | ARRAY_SEGMENT_EL HPAREXPSEPARATOR ARRAY_SEGMENT ; ARRAY_SEGMENT_EL: HIDENTIFIER ; BAUND_PAIR_LIST : BAUND_PAIR | BAUND_PAIR HPAREXPSEPARATOR BAUND_PAIR_LIST ; BAUND_PAIR : EXPRESSION HLABELSEPARATOR EXPRESSION ; SWITCH_LIST : EXPRESSION | EXPRESSION HPAREXPSEPARATOR SWITCH_LIST ; HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {} MBEE_MODE_PART {} MBEE_SPEC_PART {} MBEE_PROT_PART {} MBEE_VIRT_PART ; MBEE_FMAL_PAR_P : /*EMPT*/ | FMAL_PAR_PART ; FMAL_PAR_PART : HBEGPAR NO_TYPE MBEE_LISTV HENDPAR ; MBEE_LISTV : /*EMPT*/ | LISTV ; LISTV : HIDENTIFIER | FPP_CATEG HDOTDOTDOT | HIDENTIFIER {} HPAREXPSEPARATOR LISTV | FPP_SPEC | FPP_SPEC HPAREXPSEPARATOR LISTV ; FPP_HEADING : HBEGPAR NO_TYPE FPP_MBEE_LISTV HENDPAR ; FPP_MBEE_LISTV : /*EMPT*/ | FPP_LISTV ; FPP_LISTV : FPP_CATEG HDOTDOTDOT | FPP_SPEC | FPP_SPEC HPAREXPSEPARATOR LISTV ; FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER | FPP_CATEG FPP_PROC_DECL_IN_SPEC ; FPP_CATEG : HNAME HLABELSEPARATOR | HVALUE HLABELSEPARATOR | HVAR HLABELSEPARATOR | /*EMPT*/ ; FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE HIDENTIFIER {} FPP_HEADING {} { /* Yes, two "final" actions. */ } ; IDENTIFIER_LISTV: HIDENTIFIER | HDOTDOTDOT | HIDENTIFIER {} HPAREXPSEPARATOR IDENTIFIER_LISTV ; MBEE_MODE_PART : /*EMPT*/ | MODE_PART ; MODE_PART : NAME_PART | VALUE_PART | VAR_PART | NAME_PART VALUE_PART | VALUE_PART NAME_PART | NAME_PART VAR_PART | VAR_PART NAME_PART | VALUE_PART VAR_PART | VAR_PART VALUE_PART | VAR_PART NAME_PART VALUE_PART | NAME_PART VAR_PART VALUE_PART | NAME_PART VALUE_PART VAR_PART | VAR_PART VALUE_PART NAME_PART | VALUE_PART VAR_PART NAME_PART | VALUE_PART NAME_PART VAR_PART ; NAME_PART : HNAME {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; VAR_PART : HVAR {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; VALUE_PART : HVALUE {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; MBEE_SPEC_PART : /*EMPT*/ | SPEC_PART ; SPEC_PART : ONE_SPEC | SPEC_PART ONE_SPEC ; ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR {} PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR IDENTIFIER_LIST HSTATEMENTSEPARATOR ; SPECIFIER : TYPE | MBEE_TYPE HARRAY | HLABEL | HSWITCH ; PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING {} MBEE_BEGIN_END ; MBEE_BEGIN_END : /* EMPTY */ | HBEGIN HEND ; MBEE_PROT_PART : /*EMPT*/ | PROTECTION_PART ; PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR | PROTECTION_PART PROT_SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR ; PROT_SPECIFIER : HHIDDEN | HPROTECTED | HHIDDEN HPROTECTED | HPROTECTED HHIDDEN ; MBEE_VIRT_PART : /*EMPT*/ | VIRTUAL_PART ; VIRTUAL_PART : HVIRTUAL HLABELSEPARATOR MBEE_SPEC_PART ; IDENTIFIER_LIST : HIDENTIFIER | IDENTIFIER_LIST HPAREXPSEPARATOR HIDENTIFIER ; IDENTIFIER_LISTC: HIDENTIFIER MBEE_CONSTANT | IDENTIFIER_LISTC HPAREXPSEPARATOR HIDENTIFIER MBEE_CONSTANT ; MBEE_CONSTANT : /* EMPTY */ | HVALRELOPERATOR {} EXPRESSION ; /* GRAMATIKK FOR UTTRYKK */ EXPRESSION : EXPRESSION_SIMP | HIF EXPRESSION HTHEN EXPRESSION HELSE EXPRESSION ; EXPRESSION_SIMP : EXPRESSION_SIMP HASSIGN EXPRESSION | EXPRESSION_SIMP HCONC EXPRESSION_SIMP | EXPRESSION_SIMP HOR HELSE EXPRESSION_SIMP %prec HORELSE | EXPRESSION_SIMP HAND HTHEN EXPRESSION_SIMP %prec HANDTHEN | EXPRESSION_SIMP HEQV EXPRESSION_SIMP | EXPRESSION_SIMP HIMP EXPRESSION_SIMP | EXPRESSION_SIMP HOR EXPRESSION_SIMP | EXPRESSION_SIMP HAND EXPRESSION_SIMP | HNOT EXPRESSION_SIMP | EXPRESSION_SIMP HVALRELOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HREFRELOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HOBJRELOPERATOR EXPRESSION_SIMP | HTERMOPERATOR EXPRESSION_SIMP %prec UNEAR | EXPRESSION_SIMP HTERMOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HFACTOROPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HPRIMARYOPERATOR EXPRESSION_SIMP | HBEGPAR EXPRESSION HENDPAR | HTEXTKONST | HCHARACTERKONST | HREALKONST | HINTEGERKONST | HBOOLEANKONST | HNONE | HIDENTIFIER {} MBEE_ARG_R_PT | HTHIS HIDENTIFIER | HNEW HIDENTIFIER ARG_R_PT | EXPRESSION_SIMP HDOT EXPRESSION_SIMP | EXPRESSION_SIMP HQUA HIDENTIFIER ; ARG_R_PT : /*EMPTY*/ | HBEGPAR ARGUMENT_LIST HENDPAR ; MBEE_ARG_R_PT : /*EMPTY*/ | HBEGPAR ARGUMENT_LIST HENDPAR ; ARGUMENT_LIST : EXPRESSION | EXPRESSION HPAREXPSEPARATOR ARGUMENT_LIST ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:128.18: warning: empty rule without %empty [-Wempty-rule] input.y:137.18: warning: empty rule without %empty [-Wempty-rule] input.y:142.18: warning: empty rule without %empty [-Wempty-rule] input.y:161.18: warning: empty rule without %empty [-Wempty-rule] input.y:179.18: warning: empty rule without %empty [-Wempty-rule] input.y:205.18: warning: empty rule without %empty [-Wempty-rule] input.y:213.18: warning: empty rule without %empty [-Wempty-rule] input.y:225.18: warning: empty rule without %empty [-Wempty-rule] input.y:292.18: warning: empty rule without %empty [-Wempty-rule] input.y:294.20: warning: empty rule without %empty [-Wempty-rule] input.y:367.18: warning: empty rule without %empty [-Wempty-rule] input.y:373.18: warning: empty rule without %empty [-Wempty-rule] input.y:387.18: warning: empty rule without %empty [-Wempty-rule] input.y:401.18: warning: empty rule without %empty [-Wempty-rule] input.y:413.18: warning: empty rule without %empty [-Wempty-rule] input.y:443.18: warning: empty rule without %empty [-Wempty-rule] input.y:471.18: warning: empty rule without %empty [-Wempty-rule] input.y:474.18: warning: empty rule without %empty [-Wempty-rule] input.y:489.18: warning: empty rule without %empty [-Wempty-rule] input.y:506.18: warning: empty rule without %empty [-Wempty-rule] input.y:587.18: warning: empty rule without %empty [-Wempty-rule] input.y:591.18: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence] input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence] input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence] input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence] input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence] input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:128.18: warning: empty rule without %empty [-Wempty-rule] input.y:137.18: warning: empty rule without %empty [-Wempty-rule] input.y:142.18: warning: empty rule without %empty [-Wempty-rule] input.y:161.18: warning: empty rule without %empty [-Wempty-rule] input.y:179.18: warning: empty rule without %empty [-Wempty-rule] input.y:205.18: warning: empty rule without %empty [-Wempty-rule] input.y:213.18: warning: empty rule without %empty [-Wempty-rule] input.y:225.18: warning: empty rule without %empty [-Wempty-rule] input.y:292.18: warning: empty rule without %empty [-Wempty-rule] input.y:294.20: warning: empty rule without %empty [-Wempty-rule] input.y:367.18: warning: empty rule without %empty [-Wempty-rule] input.y:373.18: warning: empty rule without %empty [-Wempty-rule] input.y:387.18: warning: empty rule without %empty [-Wempty-rule] input.y:401.18: warning: empty rule without %empty [-Wempty-rule] input.y:413.18: warning: empty rule without %empty [-Wempty-rule] input.y:443.18: warning: empty rule without %empty [-Wempty-rule] input.y:471.18: warning: empty rule without %empty [-Wempty-rule] input.y:474.18: warning: empty rule without %empty [-Wempty-rule] input.y:489.18: warning: empty rule without %empty [-Wempty-rule] input.y:506.18: warning: empty rule without %empty [-Wempty-rule] input.y:587.18: warning: empty rule without %empty [-Wempty-rule] input.y:591.18: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence] input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence] input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence] input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence] input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence] input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:808" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:808" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "442 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed 's/^%define lr.type .*\$//' input.y > input-lalr.y" at_fn_check_prepare_dynamic "sed 's/^%define lr.type .*$//' input.y > input-lalr.y" "existing.at:808" ( $at_check_trace; sed 's/^%define lr.type .*$//' input.y > input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:808" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if $DIFF_U_WORKS; then { set +x printf "%s\n" "$at_srcdir/existing.at:808: diff -u input-lalr.output input.output | sed -n '/^@@/,\$p' | sed 's/^ \$//'" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:808" ( $at_check_trace; diff -u input-lalr.output input.output | sed -n '/^@@/,$p' | sed 's/^ $//' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: grep '^State.*conflicts:' input.output" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; grep '^State.*conflicts:' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 64 conflicts: 14 shift/reduce State 164 conflicts: 1 shift/reduce State 201 conflicts: 33 shift/reduce, 4 reduce/reduce State 206 conflicts: 1 shift/reduce State 240 conflicts: 1 shift/reduce State 335 conflicts: 9 shift/reduce, 2 reduce/reduce State 356 conflicts: 1 shift/reduce State 360 conflicts: 9 shift/reduce, 2 reduce/reduce State 427 conflicts: 9 shift/reduce, 2 reduce/reduce " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "existing.at:808" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:808" { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:808" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:808" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_620 #AT_START_621 at_fn_group_banner 621 'existing.at:808' \ "GNU Cim Grammar: Canonical LR(1)" " " 24 at_xfail=no ( printf "%s\n" "621. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %token HACTIVATE HAFTER /*HAND*/ HARRAY HAT HBEFORE HBEGIN HBOOLEAN HCHARACTER HCLASS /*HCOMMENT*/ HCONC HDELAY HDO HELSE HEND HEQ /*HEQV*/ HEXTERNAL HFOR HGE HGO HGOTO HGT HHIDDEN HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS HLABEL HLE HLONG HLT HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT /*HOR*/ HOTHERWISE HPRIOR HPROCEDURE HPROTECTED HQUA HREACTIVATE HREAL HREF HSHORT HSTEP HSWITCH HTEXT HTHEN HTHIS HTO HUNTIL HVALUE HVAR HVIRTUAL HWHEN HWHILE HASSIGNVALUE HASSIGNREF /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR HBEGPAR HENDPAR HEQR HNER HADD HSUB HMUL HDIV HINTDIV HEXP HDOTDOTDOT %token HIDENTIFIER %token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST %token HREALKONST %token HTEXTKONST %right HASSIGN %left HORELSE %left HANDTHEN %left HEQV %left HIMP %left HOR %left HAND %left HNOT %left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR %left HCONC %left HTERMOPERATOR %left UNEAR %left HFACTOROPERATOR %left HPRIMARYOPERATOR %left HQUA %left HDOT %start MAIN_MODULE %% /* GRAMATIKK FOR PROGRAM MODULES */ MAIN_MODULE : {} MODULS | error HSTATEMENTSEPARATOR MBEE_DECLSTMS ; EXT_DECLARATION : HEXTERNAL MBEE_TYPE HPROCEDURE {} EXT_LIST | HEXTERNAL HIDENTIFIER HPROCEDURE {} HIDENTIFIER {} EXTERNAL_KIND_ITEM | HEXTERNAL HCLASS {} EXT_LIST ; EXTERNAL_KIND_ITEM: EXT_IDENT HOBJRELOPERATOR {} MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING EMPTY_BLOCK {} /* | EXT_IDENT {} MBEE_REST_EXT_LIST ; MBEE_REST_EXT_LIST: /* EMPTY | HPAREXPSEPARATOR EXT_KIND_LIST ; EXT_KIND_LIST : EXT_KIND_ITEM | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM ; EXT_KIND_ITEM : HIDENTIFIER EXT_IDENT {}*/ ; EMPTY_BLOCK : /*EMPT*/ | HBEGIN HEND ; EXT_LIST : EXT_ITEM | EXT_LIST HPAREXPSEPARATOR EXT_ITEM ; EXT_ITEM : HIDENTIFIER EXT_IDENT ; EXT_IDENT : /* EMPTY */ | HVALRELOPERATOR {} HTEXTKONST ; /* GRAMATIKK FOR TYPER */ NO_TYPE : /*EMPT*/ ; MBEE_TYPE : NO_TYPE | TYPE ; TYPE : HREF HBEGPAR HIDENTIFIER {} HENDPAR | HTEXT | HBOOLEAN | HCHARACTER | HSHORT HINTEGER | HINTEGER | HREAL | HLONG HREAL ; /* GRAMATIKK FOR DEL AV SETNINGER */ MBEE_ELSE_PART : /*EMPT*/ /* | HELSE HIF EXPRESSION HTHEN {} BLOCK {} MBEE_ELSE_PART {}*/ | HELSE {} BLOCK ; FOR_LIST : FOR_LIST_ELEMENT | FOR_LIST_ELEMENT HPAREXPSEPARATOR FOR_LIST ; FOR_LIST_ELEMENT: EXPRESSION MBEE_F_L_EL_R_PT ; MBEE_F_L_EL_R_PT: /*EMPT*/ | HWHILE EXPRESSION | HSTEP EXPRESSION HUNTIL EXPRESSION ; GOTO : HGO HTO | HGOTO ; CONN_STATE_R_PT : WHEN_CLAUSE_LIST | HDO {} BLOCK ; WHEN_CLAUSE_LIST: HWHEN HIDENTIFIER HDO {} BLOCK | WHEN_CLAUSE_LIST HWHEN HIDENTIFIER HDO {} BLOCK ; MBEE_OTWI_CLAUS : /*EMPT*/ | HOTHERWISE {} BLOCK ; ACTIVATOR : HACTIVATE | HREACTIVATE ; SCHEDULE : /*EMPT*/ | ATDELAY EXPRESSION {} PRIOR | BEFOREAFTER {} EXPRESSION ; ATDELAY : HAT | HDELAY ; BEFOREAFTER : HBEFORE | HAFTER ; PRIOR : /*EMPT*/ | HPRIOR ; /* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */ MODULSTATEMENT : HWHILE EXPRESSION HDO {} BLOCK | HIF EXPRESSION HTHEN {} BLOCK {} MBEE_ELSE_PART | HFOR HIDENTIFIER HASSIGN {} FOR_LIST HDO {} BLOCK | GOTO EXPRESSION | HINSPECT EXPRESSION {} CONN_STATE_R_PT {} MBEE_OTWI_CLAUS | HINNER | HIDENTIFIER HLABELSEPARATOR {} DECLSTATEMENT | EXPRESSION_SIMP HBEGIN {} IMPORT_SPEC_MODULE {} MBEE_DECLSTMS HEND | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND | EXPRESSION_SIMP HBEGIN error HEND | EXPRESSION_SIMP | ACTIVATOR EXPRESSION SCHEDULE | HBEGIN {} MBEE_DECLSTMS HEND | MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING BLOCK | HIDENTIFIER HCLASS NO_TYPE {} IMPORT_SPEC_MODULE HIDENTIFIER {} HEADING BLOCK | HCLASS NO_TYPE HIDENTIFIER {} HEADING BLOCK | EXT_DECLARATION | /*EMPT*/ ; IMPORT_SPEC_MODULE: ; DECLSTATEMENT : MODULSTATEMENT | TYPE HIDENTIFIER MBEE_CONSTANT HPAREXPSEPARATOR {} IDENTIFIER_LISTC | TYPE HIDENTIFIER MBEE_CONSTANT | MBEE_TYPE HARRAY {} ARR_SEGMENT_LIST | HSWITCH HIDENTIFIER HASSIGN {} SWITCH_LIST ; BLOCK : DECLSTATEMENT | HBEGIN MBEE_DECLSTMS HEND | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND | HBEGIN error HEND ; MBEE_DECLSTMS : MBEE_DECLSTMSU ; MBEE_DECLSTMSU : DECLSTATEMENT | MBEE_DECLSTMSU HSTATEMENTSEPARATOR DECLSTATEMENT ; MODULS : MODULSTATEMENT | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT ; /* GRAMATIKK FOR DEL AV DEKLARASJONER */ ARR_SEGMENT_LIST: ARR_SEGMENT | ARR_SEGMENT_LIST HPAREXPSEPARATOR ARR_SEGMENT ; ARR_SEGMENT : ARRAY_SEGMENT HBEGPAR BAUND_PAIR_LIST HENDPAR ; ARRAY_SEGMENT : ARRAY_SEGMENT_EL {} | ARRAY_SEGMENT_EL HPAREXPSEPARATOR ARRAY_SEGMENT ; ARRAY_SEGMENT_EL: HIDENTIFIER ; BAUND_PAIR_LIST : BAUND_PAIR | BAUND_PAIR HPAREXPSEPARATOR BAUND_PAIR_LIST ; BAUND_PAIR : EXPRESSION HLABELSEPARATOR EXPRESSION ; SWITCH_LIST : EXPRESSION | EXPRESSION HPAREXPSEPARATOR SWITCH_LIST ; HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {} MBEE_MODE_PART {} MBEE_SPEC_PART {} MBEE_PROT_PART {} MBEE_VIRT_PART ; MBEE_FMAL_PAR_P : /*EMPT*/ | FMAL_PAR_PART ; FMAL_PAR_PART : HBEGPAR NO_TYPE MBEE_LISTV HENDPAR ; MBEE_LISTV : /*EMPT*/ | LISTV ; LISTV : HIDENTIFIER | FPP_CATEG HDOTDOTDOT | HIDENTIFIER {} HPAREXPSEPARATOR LISTV | FPP_SPEC | FPP_SPEC HPAREXPSEPARATOR LISTV ; FPP_HEADING : HBEGPAR NO_TYPE FPP_MBEE_LISTV HENDPAR ; FPP_MBEE_LISTV : /*EMPT*/ | FPP_LISTV ; FPP_LISTV : FPP_CATEG HDOTDOTDOT | FPP_SPEC | FPP_SPEC HPAREXPSEPARATOR LISTV ; FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER | FPP_CATEG FPP_PROC_DECL_IN_SPEC ; FPP_CATEG : HNAME HLABELSEPARATOR | HVALUE HLABELSEPARATOR | HVAR HLABELSEPARATOR | /*EMPT*/ ; FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE HIDENTIFIER {} FPP_HEADING {} { /* Yes, two "final" actions. */ } ; IDENTIFIER_LISTV: HIDENTIFIER | HDOTDOTDOT | HIDENTIFIER {} HPAREXPSEPARATOR IDENTIFIER_LISTV ; MBEE_MODE_PART : /*EMPT*/ | MODE_PART ; MODE_PART : NAME_PART | VALUE_PART | VAR_PART | NAME_PART VALUE_PART | VALUE_PART NAME_PART | NAME_PART VAR_PART | VAR_PART NAME_PART | VALUE_PART VAR_PART | VAR_PART VALUE_PART | VAR_PART NAME_PART VALUE_PART | NAME_PART VAR_PART VALUE_PART | NAME_PART VALUE_PART VAR_PART | VAR_PART VALUE_PART NAME_PART | VALUE_PART VAR_PART NAME_PART | VALUE_PART NAME_PART VAR_PART ; NAME_PART : HNAME {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; VAR_PART : HVAR {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; VALUE_PART : HVALUE {} IDENTIFIER_LISTV HSTATEMENTSEPARATOR ; MBEE_SPEC_PART : /*EMPT*/ | SPEC_PART ; SPEC_PART : ONE_SPEC | SPEC_PART ONE_SPEC ; ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR {} PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR IDENTIFIER_LIST HSTATEMENTSEPARATOR ; SPECIFIER : TYPE | MBEE_TYPE HARRAY | HLABEL | HSWITCH ; PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE HIDENTIFIER {} HEADING {} MBEE_BEGIN_END ; MBEE_BEGIN_END : /* EMPTY */ | HBEGIN HEND ; MBEE_PROT_PART : /*EMPT*/ | PROTECTION_PART ; PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR | PROTECTION_PART PROT_SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR ; PROT_SPECIFIER : HHIDDEN | HPROTECTED | HHIDDEN HPROTECTED | HPROTECTED HHIDDEN ; MBEE_VIRT_PART : /*EMPT*/ | VIRTUAL_PART ; VIRTUAL_PART : HVIRTUAL HLABELSEPARATOR MBEE_SPEC_PART ; IDENTIFIER_LIST : HIDENTIFIER | IDENTIFIER_LIST HPAREXPSEPARATOR HIDENTIFIER ; IDENTIFIER_LISTC: HIDENTIFIER MBEE_CONSTANT | IDENTIFIER_LISTC HPAREXPSEPARATOR HIDENTIFIER MBEE_CONSTANT ; MBEE_CONSTANT : /* EMPTY */ | HVALRELOPERATOR {} EXPRESSION ; /* GRAMATIKK FOR UTTRYKK */ EXPRESSION : EXPRESSION_SIMP | HIF EXPRESSION HTHEN EXPRESSION HELSE EXPRESSION ; EXPRESSION_SIMP : EXPRESSION_SIMP HASSIGN EXPRESSION | EXPRESSION_SIMP HCONC EXPRESSION_SIMP | EXPRESSION_SIMP HOR HELSE EXPRESSION_SIMP %prec HORELSE | EXPRESSION_SIMP HAND HTHEN EXPRESSION_SIMP %prec HANDTHEN | EXPRESSION_SIMP HEQV EXPRESSION_SIMP | EXPRESSION_SIMP HIMP EXPRESSION_SIMP | EXPRESSION_SIMP HOR EXPRESSION_SIMP | EXPRESSION_SIMP HAND EXPRESSION_SIMP | HNOT EXPRESSION_SIMP | EXPRESSION_SIMP HVALRELOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HREFRELOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HOBJRELOPERATOR EXPRESSION_SIMP | HTERMOPERATOR EXPRESSION_SIMP %prec UNEAR | EXPRESSION_SIMP HTERMOPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HFACTOROPERATOR EXPRESSION_SIMP | EXPRESSION_SIMP HPRIMARYOPERATOR EXPRESSION_SIMP | HBEGPAR EXPRESSION HENDPAR | HTEXTKONST | HCHARACTERKONST | HREALKONST | HINTEGERKONST | HBOOLEANKONST | HNONE | HIDENTIFIER {} MBEE_ARG_R_PT | HTHIS HIDENTIFIER | HNEW HIDENTIFIER ARG_R_PT | EXPRESSION_SIMP HDOT EXPRESSION_SIMP | EXPRESSION_SIMP HQUA HIDENTIFIER ; ARG_R_PT : /*EMPTY*/ | HBEGPAR ARGUMENT_LIST HENDPAR ; MBEE_ARG_R_PT : /*EMPTY*/ | HBEGPAR ARGUMENT_LIST HENDPAR ; ARGUMENT_LIST : EXPRESSION | EXPRESSION HPAREXPSEPARATOR ARGUMENT_LIST ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:128.18: warning: empty rule without %empty [-Wempty-rule] input.y:137.18: warning: empty rule without %empty [-Wempty-rule] input.y:142.18: warning: empty rule without %empty [-Wempty-rule] input.y:161.18: warning: empty rule without %empty [-Wempty-rule] input.y:179.18: warning: empty rule without %empty [-Wempty-rule] input.y:205.18: warning: empty rule without %empty [-Wempty-rule] input.y:213.18: warning: empty rule without %empty [-Wempty-rule] input.y:225.18: warning: empty rule without %empty [-Wempty-rule] input.y:292.18: warning: empty rule without %empty [-Wempty-rule] input.y:294.20: warning: empty rule without %empty [-Wempty-rule] input.y:367.18: warning: empty rule without %empty [-Wempty-rule] input.y:373.18: warning: empty rule without %empty [-Wempty-rule] input.y:387.18: warning: empty rule without %empty [-Wempty-rule] input.y:401.18: warning: empty rule without %empty [-Wempty-rule] input.y:413.18: warning: empty rule without %empty [-Wempty-rule] input.y:443.18: warning: empty rule without %empty [-Wempty-rule] input.y:471.18: warning: empty rule without %empty [-Wempty-rule] input.y:474.18: warning: empty rule without %empty [-Wempty-rule] input.y:489.18: warning: empty rule without %empty [-Wempty-rule] input.y:506.18: warning: empty rule without %empty [-Wempty-rule] input.y:587.18: warning: empty rule without %empty [-Wempty-rule] input.y:591.18: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence] input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence] input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence] input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence] input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence] input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:128.18: warning: empty rule without %empty [-Wempty-rule] input.y:137.18: warning: empty rule without %empty [-Wempty-rule] input.y:142.18: warning: empty rule without %empty [-Wempty-rule] input.y:161.18: warning: empty rule without %empty [-Wempty-rule] input.y:179.18: warning: empty rule without %empty [-Wempty-rule] input.y:205.18: warning: empty rule without %empty [-Wempty-rule] input.y:213.18: warning: empty rule without %empty [-Wempty-rule] input.y:225.18: warning: empty rule without %empty [-Wempty-rule] input.y:292.18: warning: empty rule without %empty [-Wempty-rule] input.y:294.20: warning: empty rule without %empty [-Wempty-rule] input.y:367.18: warning: empty rule without %empty [-Wempty-rule] input.y:373.18: warning: empty rule without %empty [-Wempty-rule] input.y:387.18: warning: empty rule without %empty [-Wempty-rule] input.y:401.18: warning: empty rule without %empty [-Wempty-rule] input.y:413.18: warning: empty rule without %empty [-Wempty-rule] input.y:443.18: warning: empty rule without %empty [-Wempty-rule] input.y:471.18: warning: empty rule without %empty [-Wempty-rule] input.y:474.18: warning: empty rule without %empty [-Wempty-rule] input.y:489.18: warning: empty rule without %empty [-Wempty-rule] input.y:506.18: warning: empty rule without %empty [-Wempty-rule] input.y:587.18: warning: empty rule without %empty [-Wempty-rule] input.y:591.18: warning: empty rule without %empty [-Wempty-rule] input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr] input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr] input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence] input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence] input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence] input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence] input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence] input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:808" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:808" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:808" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "10425 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "existing.at:808" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:808" { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:808" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:808" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:808: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:808" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:808" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_621 #AT_START_622 at_fn_group_banner 622 'existing.at:1460' \ "GNU pic (Groff 1.18.1) Grammar: LALR(1)" " " 24 at_xfail=no ( printf "%s\n" "622. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type lalr %define parse.error verbose %token LABEL %token VARIABLE %token NUMBER %token TEXT %token COMMAND_LINE %token DELIMITED %token ORDINAL %token TH %token LEFT_ARROW_HEAD %token RIGHT_ARROW_HEAD %token DOUBLE_ARROW_HEAD %token LAST %token UP %token DOWN %token LEFT %token RIGHT %token BOX %token CIRCLE %token ELLIPSE %token ARC %token LINE %token ARROW %token MOVE %token SPLINE %token HEIGHT %token RADIUS %token WIDTH %token DIAMETER %token FROM %token TO %token AT %token WITH %token BY %token THEN %token SOLID %token DOTTED %token DASHED %token CHOP %token SAME %token INVISIBLE %token LJUST %token RJUST %token ABOVE %token BELOW %token OF %token THE %token WAY %token BETWEEN %token AND %token HERE %token DOT_N %token DOT_E %token DOT_W %token DOT_S %token DOT_NE %token DOT_SE %token DOT_NW %token DOT_SW %token DOT_C %token DOT_START %token DOT_END %token DOT_X %token DOT_Y %token DOT_HT %token DOT_WID %token DOT_RAD %token SIN %token COS %token ATAN2 %token LOG %token EXP %token SQRT %token K_MAX %token K_MIN %token INT %token RAND %token SRAND %token COPY %token THROUGH %token TOP %token BOTTOM %token UPPER %token LOWER %token SH %token PRINT %token CW %token CCW %token FOR %token DO %token IF %token ELSE %token ANDAND %token OROR %token NOTEQUAL %token EQUALEQUAL %token LESSEQUAL %token GREATEREQUAL %token LEFT_CORNER %token RIGHT_CORNER %token NORTH %token SOUTH %token EAST %token WEST %token CENTER %token END %token START %token RESET %token UNTIL %token PLOT %token THICKNESS %token FILL %token COLORED %token OUTLINED %token SHADED %token ALIGNED %token SPRINTF %token COMMAND %left '.' /* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ %left PLOT %left TEXT SPRINTF /* give text adjustments higher precedence than TEXT, so that box "foo" above ljust == box ("foo" above ljust) */ %left LJUST RJUST ABOVE BELOW %left LEFT RIGHT /* Give attributes that take an optional expression a higher precedence than left and right, so that eg 'line chop left' parses properly. */ %left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED %left LABEL %left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST %left ORDINAL HERE '`' %left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ /* these need to be lower than '-' */ %left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS /* these must have higher precedence than CHOP so that 'label %prec CHOP' works */ %left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C %left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER %left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END %left ',' %left OROR %left ANDAND %left EQUALEQUAL NOTEQUAL %left '<' '>' LESSEQUAL GREATEREQUAL %left BETWEEN OF %left AND %left '+' '-' %left '*' '/' '%' %right '!' %right '^' %% top: optional_separator | element_list ; element_list: optional_separator middle_element_list optional_separator ; middle_element_list: element | middle_element_list separator element ; optional_separator: /* empty */ | separator ; separator: ';' | separator ';' ; placeless_element: VARIABLE '=' any_expr | VARIABLE ':' '=' any_expr | UP | DOWN | LEFT | RIGHT | COMMAND_LINE | COMMAND print_args | PRINT print_args | SH {} DELIMITED | COPY TEXT | COPY TEXT THROUGH {} DELIMITED {} until | COPY THROUGH {} DELIMITED {} until | FOR VARIABLE '=' expr TO expr optional_by DO {} DELIMITED | simple_if | simple_if ELSE {} DELIMITED | reset_variables | RESET ; reset_variables: RESET VARIABLE | reset_variables VARIABLE | reset_variables ',' VARIABLE ; print_args: print_arg | print_args print_arg ; print_arg: expr %prec ',' | text | position %prec ',' ; simple_if: IF any_expr THEN {} DELIMITED ; until: /* empty */ | UNTIL TEXT ; any_expr: expr | text_expr ; text_expr: text EQUALEQUAL text | text NOTEQUAL text | text_expr ANDAND text_expr | text_expr ANDAND expr | expr ANDAND text_expr | text_expr OROR text_expr | text_expr OROR expr | expr OROR text_expr | '!' text_expr ; optional_by: /* empty */ | BY expr | BY '*' expr ; element: object_spec | LABEL ':' optional_separator element | LABEL ':' optional_separator position_not_place | LABEL ':' optional_separator place | '{' {} element_list '}' {} optional_element | placeless_element ; optional_element: /* empty */ | element ; object_spec: BOX | CIRCLE | ELLIPSE | ARC | LINE | ARROW | MOVE | SPLINE | text %prec TEXT | PLOT expr | PLOT expr text | '[' {} element_list ']' | object_spec HEIGHT expr | object_spec RADIUS expr | object_spec WIDTH expr | object_spec DIAMETER expr | object_spec expr %prec HEIGHT | object_spec UP | object_spec UP expr | object_spec DOWN | object_spec DOWN expr | object_spec RIGHT | object_spec RIGHT expr | object_spec LEFT | object_spec LEFT expr | object_spec FROM position | object_spec TO position | object_spec AT position | object_spec WITH path | object_spec WITH position %prec ',' | object_spec BY expr_pair | object_spec THEN | object_spec SOLID | object_spec DOTTED | object_spec DOTTED expr | object_spec DASHED | object_spec DASHED expr | object_spec FILL | object_spec FILL expr | object_spec SHADED text | object_spec COLORED text | object_spec OUTLINED text | object_spec CHOP | object_spec CHOP expr | object_spec SAME | object_spec INVISIBLE | object_spec LEFT_ARROW_HEAD | object_spec RIGHT_ARROW_HEAD | object_spec DOUBLE_ARROW_HEAD | object_spec CW | object_spec CCW | object_spec text %prec TEXT | object_spec LJUST | object_spec RJUST | object_spec ABOVE | object_spec BELOW | object_spec THICKNESS expr | object_spec ALIGNED ; text: TEXT | SPRINTF '(' TEXT sprintf_args ')' ; sprintf_args: /* empty */ | sprintf_args ',' expr ; position: position_not_place | place ; position_not_place: expr_pair | position '+' expr_pair | position '-' expr_pair | '(' position ',' position ')' | expr between position AND position | expr '<' position ',' position '>' ; between: BETWEEN | OF THE WAY BETWEEN ; expr_pair: expr ',' expr | '(' expr_pair ')' ; place: /* line at A left == line (at A) left */ label %prec CHOP | label corner | corner label | corner OF label | HERE ; label: LABEL | nth_primitive | label '.' LABEL ; ordinal: ORDINAL | '`' any_expr TH ; optional_ordinal_last: LAST | ordinal LAST ; nth_primitive: ordinal object_type | optional_ordinal_last object_type ; object_type: BOX | CIRCLE | ELLIPSE | ARC | LINE | ARROW | SPLINE | '[' ']' | TEXT ; label_path: '.' LABEL | label_path '.' LABEL ; relative_path: corner %prec CHOP /* give this a lower precedence than LEFT and RIGHT so that [A: box] with .A left == [A: box] with (.A left) */ | label_path %prec TEXT | label_path corner ; path: relative_path | '(' relative_path ',' relative_path ')' {} /* The rest of these rules are a compatibility sop. */ | ORDINAL LAST object_type relative_path | LAST object_type relative_path | ORDINAL object_type relative_path | LABEL relative_path ; corner: DOT_N | DOT_E | DOT_W | DOT_S | DOT_NE | DOT_SE | DOT_NW | DOT_SW | DOT_C | DOT_START | DOT_END | TOP | BOTTOM | LEFT | RIGHT | UPPER LEFT | LOWER LEFT | UPPER RIGHT | LOWER RIGHT | LEFT_CORNER | RIGHT_CORNER | UPPER LEFT_CORNER | LOWER LEFT_CORNER | UPPER RIGHT_CORNER | LOWER RIGHT_CORNER | NORTH | SOUTH | EAST | WEST | CENTER | START | END ; expr: VARIABLE | NUMBER | place DOT_X | place DOT_Y | place DOT_HT | place DOT_WID | place DOT_RAD | expr '+' expr | expr '-' expr | expr '*' expr | expr '/' expr | expr '%' expr | expr '^' expr | '-' expr %prec '!' | '(' any_expr ')' | SIN '(' any_expr ')' | COS '(' any_expr ')' | ATAN2 '(' any_expr ',' any_expr ')' | LOG '(' any_expr ')' | EXP '(' any_expr ')' | SQRT '(' any_expr ')' | K_MAX '(' any_expr ',' any_expr ')' | K_MIN '(' any_expr ',' any_expr ')' | INT '(' any_expr ')' | RAND '(' any_expr ')' | RAND '(' ')' | SRAND '(' any_expr ')' | expr '<' expr | expr LESSEQUAL expr | expr '>' expr | expr GREATEREQUAL expr | expr EQUALEQUAL expr | expr NOTEQUAL expr | expr ANDAND expr | expr OROR expr | '!' expr ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { VARIABLE, '=', LABEL, LEFT, DOT_X, 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:202.20: warning: empty rule without %empty [-Wempty-rule] input.y:270.7: warning: empty rule without %empty [-Wempty-rule] input.y:292.13: warning: empty rule without %empty [-Wempty-rule] input.y:309.18: warning: empty rule without %empty [-Wempty-rule] input.y:382.14: warning: empty rule without %empty [-Wempty-rule] input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother] input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence] input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence] input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence] input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence] input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence] input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence] input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence] input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for '\`', use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for '[', use %precedence [-Wprecedence] input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence] input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:202.20: warning: empty rule without %empty [-Wempty-rule] input.y:270.7: warning: empty rule without %empty [-Wempty-rule] input.y:292.13: warning: empty rule without %empty [-Wempty-rule] input.y:309.18: warning: empty rule without %empty [-Wempty-rule] input.y:382.14: warning: empty rule without %empty [-Wempty-rule] input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother] input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence] input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence] input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence] input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence] input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence] input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence] input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence] input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for '[', use %precedence [-Wprecedence] input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence] input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:1460" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:1460" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "422 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed 's/^%define lr.type .*\$//' input.y > input-lalr.y" at_fn_check_prepare_dynamic "sed 's/^%define lr.type .*$//' input.y > input-lalr.y" "existing.at:1460" ( $at_check_trace; sed 's/^%define lr.type .*$//' input.y > input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if $DIFF_U_WORKS; then { set +x printf "%s\n" "$at_srcdir/existing.at:1460: diff -u input-lalr.output input.output | sed -n '/^@@/,\$p' | sed 's/^ \$//'" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:1460" ( $at_check_trace; diff -u input-lalr.output input.output | sed -n '/^@@/,$p' | sed 's/^ $//' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } fi # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "existing.at:1460" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:1460" { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:1460" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:1460" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected LEFT " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_622 #AT_START_623 at_fn_group_banner 623 'existing.at:1460' \ "GNU pic (Groff 1.18.1) Grammar: IELR(1)" " " 24 at_xfail=no ( printf "%s\n" "623. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type ielr %define parse.error verbose %token LABEL %token VARIABLE %token NUMBER %token TEXT %token COMMAND_LINE %token DELIMITED %token ORDINAL %token TH %token LEFT_ARROW_HEAD %token RIGHT_ARROW_HEAD %token DOUBLE_ARROW_HEAD %token LAST %token UP %token DOWN %token LEFT %token RIGHT %token BOX %token CIRCLE %token ELLIPSE %token ARC %token LINE %token ARROW %token MOVE %token SPLINE %token HEIGHT %token RADIUS %token WIDTH %token DIAMETER %token FROM %token TO %token AT %token WITH %token BY %token THEN %token SOLID %token DOTTED %token DASHED %token CHOP %token SAME %token INVISIBLE %token LJUST %token RJUST %token ABOVE %token BELOW %token OF %token THE %token WAY %token BETWEEN %token AND %token HERE %token DOT_N %token DOT_E %token DOT_W %token DOT_S %token DOT_NE %token DOT_SE %token DOT_NW %token DOT_SW %token DOT_C %token DOT_START %token DOT_END %token DOT_X %token DOT_Y %token DOT_HT %token DOT_WID %token DOT_RAD %token SIN %token COS %token ATAN2 %token LOG %token EXP %token SQRT %token K_MAX %token K_MIN %token INT %token RAND %token SRAND %token COPY %token THROUGH %token TOP %token BOTTOM %token UPPER %token LOWER %token SH %token PRINT %token CW %token CCW %token FOR %token DO %token IF %token ELSE %token ANDAND %token OROR %token NOTEQUAL %token EQUALEQUAL %token LESSEQUAL %token GREATEREQUAL %token LEFT_CORNER %token RIGHT_CORNER %token NORTH %token SOUTH %token EAST %token WEST %token CENTER %token END %token START %token RESET %token UNTIL %token PLOT %token THICKNESS %token FILL %token COLORED %token OUTLINED %token SHADED %token ALIGNED %token SPRINTF %token COMMAND %left '.' /* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ %left PLOT %left TEXT SPRINTF /* give text adjustments higher precedence than TEXT, so that box "foo" above ljust == box ("foo" above ljust) */ %left LJUST RJUST ABOVE BELOW %left LEFT RIGHT /* Give attributes that take an optional expression a higher precedence than left and right, so that eg 'line chop left' parses properly. */ %left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED %left LABEL %left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST %left ORDINAL HERE '`' %left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ /* these need to be lower than '-' */ %left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS /* these must have higher precedence than CHOP so that 'label %prec CHOP' works */ %left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C %left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER %left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END %left ',' %left OROR %left ANDAND %left EQUALEQUAL NOTEQUAL %left '<' '>' LESSEQUAL GREATEREQUAL %left BETWEEN OF %left AND %left '+' '-' %left '*' '/' '%' %right '!' %right '^' %% top: optional_separator | element_list ; element_list: optional_separator middle_element_list optional_separator ; middle_element_list: element | middle_element_list separator element ; optional_separator: /* empty */ | separator ; separator: ';' | separator ';' ; placeless_element: VARIABLE '=' any_expr | VARIABLE ':' '=' any_expr | UP | DOWN | LEFT | RIGHT | COMMAND_LINE | COMMAND print_args | PRINT print_args | SH {} DELIMITED | COPY TEXT | COPY TEXT THROUGH {} DELIMITED {} until | COPY THROUGH {} DELIMITED {} until | FOR VARIABLE '=' expr TO expr optional_by DO {} DELIMITED | simple_if | simple_if ELSE {} DELIMITED | reset_variables | RESET ; reset_variables: RESET VARIABLE | reset_variables VARIABLE | reset_variables ',' VARIABLE ; print_args: print_arg | print_args print_arg ; print_arg: expr %prec ',' | text | position %prec ',' ; simple_if: IF any_expr THEN {} DELIMITED ; until: /* empty */ | UNTIL TEXT ; any_expr: expr | text_expr ; text_expr: text EQUALEQUAL text | text NOTEQUAL text | text_expr ANDAND text_expr | text_expr ANDAND expr | expr ANDAND text_expr | text_expr OROR text_expr | text_expr OROR expr | expr OROR text_expr | '!' text_expr ; optional_by: /* empty */ | BY expr | BY '*' expr ; element: object_spec | LABEL ':' optional_separator element | LABEL ':' optional_separator position_not_place | LABEL ':' optional_separator place | '{' {} element_list '}' {} optional_element | placeless_element ; optional_element: /* empty */ | element ; object_spec: BOX | CIRCLE | ELLIPSE | ARC | LINE | ARROW | MOVE | SPLINE | text %prec TEXT | PLOT expr | PLOT expr text | '[' {} element_list ']' | object_spec HEIGHT expr | object_spec RADIUS expr | object_spec WIDTH expr | object_spec DIAMETER expr | object_spec expr %prec HEIGHT | object_spec UP | object_spec UP expr | object_spec DOWN | object_spec DOWN expr | object_spec RIGHT | object_spec RIGHT expr | object_spec LEFT | object_spec LEFT expr | object_spec FROM position | object_spec TO position | object_spec AT position | object_spec WITH path | object_spec WITH position %prec ',' | object_spec BY expr_pair | object_spec THEN | object_spec SOLID | object_spec DOTTED | object_spec DOTTED expr | object_spec DASHED | object_spec DASHED expr | object_spec FILL | object_spec FILL expr | object_spec SHADED text | object_spec COLORED text | object_spec OUTLINED text | object_spec CHOP | object_spec CHOP expr | object_spec SAME | object_spec INVISIBLE | object_spec LEFT_ARROW_HEAD | object_spec RIGHT_ARROW_HEAD | object_spec DOUBLE_ARROW_HEAD | object_spec CW | object_spec CCW | object_spec text %prec TEXT | object_spec LJUST | object_spec RJUST | object_spec ABOVE | object_spec BELOW | object_spec THICKNESS expr | object_spec ALIGNED ; text: TEXT | SPRINTF '(' TEXT sprintf_args ')' ; sprintf_args: /* empty */ | sprintf_args ',' expr ; position: position_not_place | place ; position_not_place: expr_pair | position '+' expr_pair | position '-' expr_pair | '(' position ',' position ')' | expr between position AND position | expr '<' position ',' position '>' ; between: BETWEEN | OF THE WAY BETWEEN ; expr_pair: expr ',' expr | '(' expr_pair ')' ; place: /* line at A left == line (at A) left */ label %prec CHOP | label corner | corner label | corner OF label | HERE ; label: LABEL | nth_primitive | label '.' LABEL ; ordinal: ORDINAL | '`' any_expr TH ; optional_ordinal_last: LAST | ordinal LAST ; nth_primitive: ordinal object_type | optional_ordinal_last object_type ; object_type: BOX | CIRCLE | ELLIPSE | ARC | LINE | ARROW | SPLINE | '[' ']' | TEXT ; label_path: '.' LABEL | label_path '.' LABEL ; relative_path: corner %prec CHOP /* give this a lower precedence than LEFT and RIGHT so that [A: box] with .A left == [A: box] with (.A left) */ | label_path %prec TEXT | label_path corner ; path: relative_path | '(' relative_path ',' relative_path ')' {} /* The rest of these rules are a compatibility sop. */ | ORDINAL LAST object_type relative_path | LAST object_type relative_path | ORDINAL object_type relative_path | LABEL relative_path ; corner: DOT_N | DOT_E | DOT_W | DOT_S | DOT_NE | DOT_SE | DOT_NW | DOT_SW | DOT_C | DOT_START | DOT_END | TOP | BOTTOM | LEFT | RIGHT | UPPER LEFT | LOWER LEFT | UPPER RIGHT | LOWER RIGHT | LEFT_CORNER | RIGHT_CORNER | UPPER LEFT_CORNER | LOWER LEFT_CORNER | UPPER RIGHT_CORNER | LOWER RIGHT_CORNER | NORTH | SOUTH | EAST | WEST | CENTER | START | END ; expr: VARIABLE | NUMBER | place DOT_X | place DOT_Y | place DOT_HT | place DOT_WID | place DOT_RAD | expr '+' expr | expr '-' expr | expr '*' expr | expr '/' expr | expr '%' expr | expr '^' expr | '-' expr %prec '!' | '(' any_expr ')' | SIN '(' any_expr ')' | COS '(' any_expr ')' | ATAN2 '(' any_expr ',' any_expr ')' | LOG '(' any_expr ')' | EXP '(' any_expr ')' | SQRT '(' any_expr ')' | K_MAX '(' any_expr ',' any_expr ')' | K_MIN '(' any_expr ',' any_expr ')' | INT '(' any_expr ')' | RAND '(' any_expr ')' | RAND '(' ')' | SRAND '(' any_expr ')' | expr '<' expr | expr LESSEQUAL expr | expr '>' expr | expr GREATEREQUAL expr | expr EQUALEQUAL expr | expr NOTEQUAL expr | expr ANDAND expr | expr OROR expr | '!' expr ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { VARIABLE, '=', LABEL, LEFT, DOT_X, 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:202.20: warning: empty rule without %empty [-Wempty-rule] input.y:270.7: warning: empty rule without %empty [-Wempty-rule] input.y:292.13: warning: empty rule without %empty [-Wempty-rule] input.y:309.18: warning: empty rule without %empty [-Wempty-rule] input.y:382.14: warning: empty rule without %empty [-Wempty-rule] input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother] input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence] input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence] input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence] input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence] input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence] input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence] input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence] input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for '\`', use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for '[', use %precedence [-Wprecedence] input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence] input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:202.20: warning: empty rule without %empty [-Wempty-rule] input.y:270.7: warning: empty rule without %empty [-Wempty-rule] input.y:292.13: warning: empty rule without %empty [-Wempty-rule] input.y:309.18: warning: empty rule without %empty [-Wempty-rule] input.y:382.14: warning: empty rule without %empty [-Wempty-rule] input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother] input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence] input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence] input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence] input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence] input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence] input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence] input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence] input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for '[', use %precedence [-Wprecedence] input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence] input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:1460" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:1460" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "427 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed 's/^%define lr.type .*\$//' input.y > input-lalr.y" at_fn_check_prepare_dynamic "sed 's/^%define lr.type .*$//' input.y > input-lalr.y" "existing.at:1460" ( $at_check_trace; sed 's/^%define lr.type .*$//' input.y > input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y" at_fn_check_prepare_notrace 'an embedded newline' "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "existing.at:1460" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all,no-cex input-lalr.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if $DIFF_U_WORKS; then { set +x printf "%s\n" "$at_srcdir/existing.at:1460: diff -u input-lalr.output input.output | sed -n '/^@@/,\$p' | sed 's/^ \$//'" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:1460" ( $at_check_trace; diff -u input-lalr.output input.output | sed -n '/^@@/,$p' | sed 's/^ $//' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "@@ -1249,7 +1249,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -1403,7 +1403,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -1880,7 +1880,7 @@ text go to state 162 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -2073,7 +2073,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -2597,7 +2597,7 @@ position_not_place go to state 99 expr_pair go to state 191 place go to state 101 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -2758,7 +2758,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -2901,7 +2901,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -3044,7 +3044,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -3282,7 +3282,7 @@ State 102 - 146 place: label . [\$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, AND, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '\`', ',', '>', '+', '-', '!', ';', '}', ']', ')'] + 146 place: label . [\$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '\`', '+', '-', '!', ';', '}', ']'] 147 | label . corner 153 label: label . '.' LABEL 180 corner: . DOT_N @@ -3671,7 +3671,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -3830,7 +3830,7 @@ text_expr go to state 239 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -4507,7 +4507,7 @@ \$default reduce using rule 89 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -4699,7 +4699,7 @@ \$default reduce using rule 91 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -4893,7 +4893,7 @@ \$default reduce using rule 95 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -5091,7 +5091,7 @@ \$default reduce using rule 93 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -5286,7 +5286,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -5429,7 +5429,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -5572,7 +5572,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -5715,7 +5715,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -6501,7 +6501,7 @@ expr_pair go to state 280 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -6659,7 +6659,7 @@ \$default reduce using rule 105 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -6851,7 +6851,7 @@ \$default reduce using rule 107 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -7043,7 +7043,7 @@ \$default reduce using rule 114 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -7290,7 +7290,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -7434,7 +7434,7 @@ \$default reduce using rule 109 (object_spec) place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -7845,12 +7845,12 @@ position_not_place go to state 296 expr_pair go to state 100 place go to state 297 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 corner go to state 106 - expr go to state 266 + expr go to state 424 State 165 @@ -8013,7 +8013,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -8198,7 +8198,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -8359,7 +8359,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -8520,7 +8520,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -8681,7 +8681,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -8842,7 +8842,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9003,7 +9003,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9164,7 +9164,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9325,7 +9325,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9486,7 +9486,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9649,7 +9649,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9810,7 +9810,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -9947,7 +9947,7 @@ \$default reduce using rule 47 (any_expr) - between go to state 237 + between go to state 425 State 193 @@ -10178,7 +10178,7 @@ expr_pair go to state 317 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -10324,7 +10324,7 @@ expr_pair go to state 318 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -10648,7 +10648,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -10791,7 +10791,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -10934,7 +10934,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11077,7 +11077,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11220,7 +11220,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11363,7 +11363,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11506,7 +11506,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11663,7 +11663,7 @@ position_not_place go to state 99 expr_pair go to state 100 place go to state 101 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11806,7 +11806,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -11949,7 +11949,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -12092,7 +12092,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -12235,7 +12235,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -12378,7 +12378,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -12521,7 +12521,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -12664,7 +12664,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -12820,12 +12820,12 @@ position_not_place go to state 99 expr_pair go to state 100 place go to state 101 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 corner go to state 106 - expr go to state 266 + expr go to state 424 State 238 @@ -12963,7 +12963,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -13186,7 +13186,7 @@ text_expr go to state 342 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -13345,7 +13345,7 @@ text_expr go to state 344 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -13528,7 +13528,7 @@ text_expr go to state 348 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -13687,7 +13687,7 @@ text_expr go to state 350 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -13830,7 +13830,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -14773,7 +14773,7 @@ position_not_place go to state 99 expr_pair go to state 191 place go to state 101 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -15100,7 +15100,7 @@ text go to state 113 expr_pair go to state 365 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -15719,12 +15719,12 @@ position_not_place go to state 99 expr_pair go to state 100 place go to state 101 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 corner go to state 106 - expr go to state 266 + expr go to state 424 State 315 @@ -16150,7 +16150,7 @@ \$default reduce using rule 239 (expr) - between go to state 237 + between go to state 425 Conflict between rule 239 and token OF resolved as shift ('<' < OF). Conflict between rule 239 and token BETWEEN resolved as shift ('<' < BETWEEN). @@ -17260,7 +17260,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -17442,7 +17442,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -17603,7 +17603,7 @@ text_expr go to state 112 text go to state 113 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -17798,12 +17798,12 @@ position_not_place go to state 99 expr_pair go to state 100 place go to state 101 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 corner go to state 106 - expr go to state 266 + expr go to state 424 State 383 @@ -18097,7 +18097,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -18247,7 +18247,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -18856,7 +18856,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -19013,7 +19013,7 @@ '!' shift, and go to state 94 place go to state 114 - label go to state 102 + label go to state 423 ordinal go to state 103 optional_ordinal_last go to state 104 nth_primitive go to state 105 @@ -19115,3 +19115,440 @@ 29 placeless_element: FOR VARIABLE '=' expr TO expr optional_by DO \$@6 DELIMITED . \$default reduce using rule 29 (placeless_element) + + +State 423 + + 146 place: label . [\$end, AND, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, ',', '>', '+', '-', ';', '}', ']', ')'] + 147 | label . corner + 153 label: label . '.' LABEL + 180 corner: . DOT_N + 181 | . DOT_E + 182 | . DOT_W + 183 | . DOT_S + 184 | . DOT_NE + 185 | . DOT_SE + 186 | . DOT_NW + 187 | . DOT_SW + 188 | . DOT_C + 189 | . DOT_START + 190 | . DOT_END + 191 | . TOP + 192 | . BOTTOM + 193 | . LEFT + 194 | . RIGHT + 195 | . UPPER LEFT + 196 | . LOWER LEFT + 197 | . UPPER RIGHT + 198 | . LOWER RIGHT + 199 | . LEFT_CORNER + 200 | . RIGHT_CORNER + 201 | . UPPER LEFT_CORNER + 202 | . LOWER LEFT_CORNER + 203 | . UPPER RIGHT_CORNER + 204 | . LOWER RIGHT_CORNER + 205 | . NORTH + 206 | . SOUTH + 207 | . EAST + 208 | . WEST + 209 | . CENTER + 210 | . START + 211 | . END + + LEFT shift, and go to state 53 + RIGHT shift, and go to state 54 + DOT_N shift, and go to state 56 + DOT_E shift, and go to state 57 + DOT_W shift, and go to state 58 + DOT_S shift, and go to state 59 + DOT_NE shift, and go to state 60 + DOT_SE shift, and go to state 61 + DOT_NW shift, and go to state 62 + DOT_SW shift, and go to state 63 + DOT_C shift, and go to state 64 + DOT_START shift, and go to state 65 + DOT_END shift, and go to state 66 + TOP shift, and go to state 78 + BOTTOM shift, and go to state 79 + UPPER shift, and go to state 80 + LOWER shift, and go to state 81 + LEFT_CORNER shift, and go to state 82 + RIGHT_CORNER shift, and go to state 83 + NORTH shift, and go to state 84 + SOUTH shift, and go to state 85 + EAST shift, and go to state 86 + WEST shift, and go to state 87 + CENTER shift, and go to state 88 + END shift, and go to state 89 + START shift, and go to state 90 + '.' shift, and go to state 204 + + \$default reduce using rule 146 (place) + + corner go to state 205 + + +State 424 + + 140 position_not_place: expr . between position AND position + 141 | expr . '<' position ',' position '>' + 142 between: . BETWEEN + 143 | . OF THE WAY BETWEEN + 144 expr_pair: expr . ',' expr + 219 expr: expr . '+' expr + 220 | expr . '-' expr + 221 | expr . '*' expr + 222 | expr . '/' expr + 223 | expr . '%' expr + 224 | expr . '^' expr + 239 | expr . '<' expr + 240 | expr . LESSEQUAL expr + 241 | expr . '>' expr + 242 | expr . GREATEREQUAL expr + 243 | expr . EQUALEQUAL expr + 244 | expr . NOTEQUAL expr + 245 | expr . ANDAND expr + 246 | expr . OROR expr + + OF shift, and go to state 220 + BETWEEN shift, and go to state 221 + ANDAND shift, and go to state 222 + OROR shift, and go to state 223 + NOTEQUAL shift, and go to state 224 + EQUALEQUAL shift, and go to state 225 + LESSEQUAL shift, and go to state 226 + GREATEREQUAL shift, and go to state 227 + ',' shift, and go to state 228 + '<' shift, and go to state 229 + '>' shift, and go to state 230 + '+' shift, and go to state 231 + '-' shift, and go to state 232 + '*' shift, and go to state 233 + '/' shift, and go to state 234 + '%' shift, and go to state 235 + '^' shift, and go to state 236 + + between go to state 425 + + +State 425 + + 134 position: . position_not_place + 135 | . place + 136 position_not_place: . expr_pair + 137 | . position '+' expr_pair + 138 | . position '-' expr_pair + 139 | . '(' position ',' position ')' + 140 | . expr between position AND position + 140 | expr between . position AND position + 141 | . expr '<' position ',' position '>' + 144 expr_pair: . expr ',' expr + 145 | . '(' expr_pair ')' + 146 place: . label + 147 | . label corner + 148 | . corner label + 149 | . corner OF label + 150 | . HERE + 151 label: . LABEL + 152 | . nth_primitive + 153 | . label '.' LABEL + 154 ordinal: . ORDINAL + 155 | . '\`' any_expr TH + 156 optional_ordinal_last: . LAST + 157 | . ordinal LAST + 158 nth_primitive: . ordinal object_type + 159 | . optional_ordinal_last object_type + 180 corner: . DOT_N + 181 | . DOT_E + 182 | . DOT_W + 183 | . DOT_S + 184 | . DOT_NE + 185 | . DOT_SE + 186 | . DOT_NW + 187 | . DOT_SW + 188 | . DOT_C + 189 | . DOT_START + 190 | . DOT_END + 191 | . TOP + 192 | . BOTTOM + 193 | . LEFT + 194 | . RIGHT + 195 | . UPPER LEFT + 196 | . LOWER LEFT + 197 | . UPPER RIGHT + 198 | . LOWER RIGHT + 199 | . LEFT_CORNER + 200 | . RIGHT_CORNER + 201 | . UPPER LEFT_CORNER + 202 | . LOWER LEFT_CORNER + 203 | . UPPER RIGHT_CORNER + 204 | . LOWER RIGHT_CORNER + 205 | . NORTH + 206 | . SOUTH + 207 | . EAST + 208 | . WEST + 209 | . CENTER + 210 | . START + 211 | . END + 212 expr: . VARIABLE + 213 | . NUMBER + 214 | . place DOT_X + 215 | . place DOT_Y + 216 | . place DOT_HT + 217 | . place DOT_WID + 218 | . place DOT_RAD + 219 | . expr '+' expr + 220 | . expr '-' expr + 221 | . expr '*' expr + 222 | . expr '/' expr + 223 | . expr '%' expr + 224 | . expr '^' expr + 225 | . '-' expr + 226 | . '(' any_expr ')' + 227 | . SIN '(' any_expr ')' + 228 | . COS '(' any_expr ')' + 229 | . ATAN2 '(' any_expr ',' any_expr ')' + 230 | . LOG '(' any_expr ')' + 231 | . EXP '(' any_expr ')' + 232 | . SQRT '(' any_expr ')' + 233 | . K_MAX '(' any_expr ',' any_expr ')' + 234 | . K_MIN '(' any_expr ',' any_expr ')' + 235 | . INT '(' any_expr ')' + 236 | . RAND '(' any_expr ')' + 237 | . RAND '(' ')' + 238 | . SRAND '(' any_expr ')' + 239 | . expr '<' expr + 240 | . expr LESSEQUAL expr + 241 | . expr '>' expr + 242 | . expr GREATEREQUAL expr + 243 | . expr EQUALEQUAL expr + 244 | . expr NOTEQUAL expr + 245 | . expr ANDAND expr + 246 | . expr OROR expr + 247 | . '!' expr + + LABEL shift, and go to state 48 + VARIABLE shift, and go to state 49 + NUMBER shift, and go to state 50 + ORDINAL shift, and go to state 51 + LAST shift, and go to state 52 + LEFT shift, and go to state 53 + RIGHT shift, and go to state 54 + HERE shift, and go to state 55 + DOT_N shift, and go to state 56 + DOT_E shift, and go to state 57 + DOT_W shift, and go to state 58 + DOT_S shift, and go to state 59 + DOT_NE shift, and go to state 60 + DOT_SE shift, and go to state 61 + DOT_NW shift, and go to state 62 + DOT_SW shift, and go to state 63 + DOT_C shift, and go to state 64 + DOT_START shift, and go to state 65 + DOT_END shift, and go to state 66 + SIN shift, and go to state 67 + COS shift, and go to state 68 + ATAN2 shift, and go to state 69 + LOG shift, and go to state 70 + EXP shift, and go to state 71 + SQRT shift, and go to state 72 + K_MAX shift, and go to state 73 + K_MIN shift, and go to state 74 + INT shift, and go to state 75 + RAND shift, and go to state 76 + SRAND shift, and go to state 77 + TOP shift, and go to state 78 + BOTTOM shift, and go to state 79 + UPPER shift, and go to state 80 + LOWER shift, and go to state 81 + LEFT_CORNER shift, and go to state 82 + RIGHT_CORNER shift, and go to state 83 + NORTH shift, and go to state 84 + SOUTH shift, and go to state 85 + EAST shift, and go to state 86 + WEST shift, and go to state 87 + CENTER shift, and go to state 88 + END shift, and go to state 89 + START shift, and go to state 90 + '(' shift, and go to state 91 + '\`' shift, and go to state 92 + '-' shift, and go to state 93 + '!' shift, and go to state 94 + + position go to state 426 + position_not_place go to state 99 + expr_pair go to state 100 + place go to state 101 + label go to state 423 + ordinal go to state 103 + optional_ordinal_last go to state 104 + nth_primitive go to state 105 + corner go to state 106 + expr go to state 424 + + +State 426 + + 137 position_not_place: position . '+' expr_pair + 138 | position . '-' expr_pair + 140 | expr between position . AND position + + AND shift, and go to state 427 + '+' shift, and go to state 197 + '-' shift, and go to state 198 + + +State 427 + + 134 position: . position_not_place + 135 | . place + 136 position_not_place: . expr_pair + 137 | . position '+' expr_pair + 138 | . position '-' expr_pair + 139 | . '(' position ',' position ')' + 140 | . expr between position AND position + 140 | expr between position AND . position + 141 | . expr '<' position ',' position '>' + 144 expr_pair: . expr ',' expr + 145 | . '(' expr_pair ')' + 146 place: . label + 147 | . label corner + 148 | . corner label + 149 | . corner OF label + 150 | . HERE + 151 label: . LABEL + 152 | . nth_primitive + 153 | . label '.' LABEL + 154 ordinal: . ORDINAL + 155 | . '\`' any_expr TH + 156 optional_ordinal_last: . LAST + 157 | . ordinal LAST + 158 nth_primitive: . ordinal object_type + 159 | . optional_ordinal_last object_type + 180 corner: . DOT_N + 181 | . DOT_E + 182 | . DOT_W + 183 | . DOT_S + 184 | . DOT_NE + 185 | . DOT_SE + 186 | . DOT_NW + 187 | . DOT_SW + 188 | . DOT_C + 189 | . DOT_START + 190 | . DOT_END + 191 | . TOP + 192 | . BOTTOM + 193 | . LEFT + 194 | . RIGHT + 195 | . UPPER LEFT + 196 | . LOWER LEFT + 197 | . UPPER RIGHT + 198 | . LOWER RIGHT + 199 | . LEFT_CORNER + 200 | . RIGHT_CORNER + 201 | . UPPER LEFT_CORNER + 202 | . LOWER LEFT_CORNER + 203 | . UPPER RIGHT_CORNER + 204 | . LOWER RIGHT_CORNER + 205 | . NORTH + 206 | . SOUTH + 207 | . EAST + 208 | . WEST + 209 | . CENTER + 210 | . START + 211 | . END + 212 expr: . VARIABLE + 213 | . NUMBER + 214 | . place DOT_X + 215 | . place DOT_Y + 216 | . place DOT_HT + 217 | . place DOT_WID + 218 | . place DOT_RAD + 219 | . expr '+' expr + 220 | . expr '-' expr + 221 | . expr '*' expr + 222 | . expr '/' expr + 223 | . expr '%' expr + 224 | . expr '^' expr + 225 | . '-' expr + 226 | . '(' any_expr ')' + 227 | . SIN '(' any_expr ')' + 228 | . COS '(' any_expr ')' + 229 | . ATAN2 '(' any_expr ',' any_expr ')' + 230 | . LOG '(' any_expr ')' + 231 | . EXP '(' any_expr ')' + 232 | . SQRT '(' any_expr ')' + 233 | . K_MAX '(' any_expr ',' any_expr ')' + 234 | . K_MIN '(' any_expr ',' any_expr ')' + 235 | . INT '(' any_expr ')' + 236 | . RAND '(' any_expr ')' + 237 | . RAND '(' ')' + 238 | . SRAND '(' any_expr ')' + 239 | . expr '<' expr + 240 | . expr LESSEQUAL expr + 241 | . expr '>' expr + 242 | . expr GREATEREQUAL expr + 243 | . expr EQUALEQUAL expr + 244 | . expr NOTEQUAL expr + 245 | . expr ANDAND expr + 246 | . expr OROR expr + 247 | . '!' expr + + LABEL shift, and go to state 48 + VARIABLE shift, and go to state 49 + NUMBER shift, and go to state 50 + ORDINAL shift, and go to state 51 + LAST shift, and go to state 52 + LEFT shift, and go to state 53 + RIGHT shift, and go to state 54 + HERE shift, and go to state 55 + DOT_N shift, and go to state 56 + DOT_E shift, and go to state 57 + DOT_W shift, and go to state 58 + DOT_S shift, and go to state 59 + DOT_NE shift, and go to state 60 + DOT_SE shift, and go to state 61 + DOT_NW shift, and go to state 62 + DOT_SW shift, and go to state 63 + DOT_C shift, and go to state 64 + DOT_START shift, and go to state 65 + DOT_END shift, and go to state 66 + SIN shift, and go to state 67 + COS shift, and go to state 68 + ATAN2 shift, and go to state 69 + LOG shift, and go to state 70 + EXP shift, and go to state 71 + SQRT shift, and go to state 72 + K_MAX shift, and go to state 73 + K_MIN shift, and go to state 74 + INT shift, and go to state 75 + RAND shift, and go to state 76 + SRAND shift, and go to state 77 + TOP shift, and go to state 78 + BOTTOM shift, and go to state 79 + UPPER shift, and go to state 80 + LOWER shift, and go to state 81 + LEFT_CORNER shift, and go to state 82 + RIGHT_CORNER shift, and go to state 83 + NORTH shift, and go to state 84 + SOUTH shift, and go to state 85 + EAST shift, and go to state 86 + WEST shift, and go to state 87 + CENTER shift, and go to state 88 + END shift, and go to state 89 + START shift, and go to state 90 + '(' shift, and go to state 91 + '\`' shift, and go to state 92 + '-' shift, and go to state 93 + '!' shift, and go to state 94 + + position go to state 402 + position_not_place go to state 99 + expr_pair go to state 100 + place go to state 101 + label go to state 423 + ordinal go to state 103 + optional_ordinal_last go to state 104 + nth_primitive go to state 105 + corner go to state 106 + expr go to state 424 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } fi # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. printf "%s\n" "existing.at:1460" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:1460" { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:1460" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:1460" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_623 #AT_START_624 at_fn_group_banner 624 'existing.at:1460' \ "GNU pic (Groff 1.18.1) Grammar: Canonical LR(1)" "" 24 at_xfail=no ( printf "%s\n" "624. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define lr.type canonical-lr %define parse.error verbose %token LABEL %token VARIABLE %token NUMBER %token TEXT %token COMMAND_LINE %token DELIMITED %token ORDINAL %token TH %token LEFT_ARROW_HEAD %token RIGHT_ARROW_HEAD %token DOUBLE_ARROW_HEAD %token LAST %token UP %token DOWN %token LEFT %token RIGHT %token BOX %token CIRCLE %token ELLIPSE %token ARC %token LINE %token ARROW %token MOVE %token SPLINE %token HEIGHT %token RADIUS %token WIDTH %token DIAMETER %token FROM %token TO %token AT %token WITH %token BY %token THEN %token SOLID %token DOTTED %token DASHED %token CHOP %token SAME %token INVISIBLE %token LJUST %token RJUST %token ABOVE %token BELOW %token OF %token THE %token WAY %token BETWEEN %token AND %token HERE %token DOT_N %token DOT_E %token DOT_W %token DOT_S %token DOT_NE %token DOT_SE %token DOT_NW %token DOT_SW %token DOT_C %token DOT_START %token DOT_END %token DOT_X %token DOT_Y %token DOT_HT %token DOT_WID %token DOT_RAD %token SIN %token COS %token ATAN2 %token LOG %token EXP %token SQRT %token K_MAX %token K_MIN %token INT %token RAND %token SRAND %token COPY %token THROUGH %token TOP %token BOTTOM %token UPPER %token LOWER %token SH %token PRINT %token CW %token CCW %token FOR %token DO %token IF %token ELSE %token ANDAND %token OROR %token NOTEQUAL %token EQUALEQUAL %token LESSEQUAL %token GREATEREQUAL %token LEFT_CORNER %token RIGHT_CORNER %token NORTH %token SOUTH %token EAST %token WEST %token CENTER %token END %token START %token RESET %token UNTIL %token PLOT %token THICKNESS %token FILL %token COLORED %token OUTLINED %token SHADED %token ALIGNED %token SPRINTF %token COMMAND %left '.' /* this ensures that plot 17 "%g" parses as (plot 17 "%g") */ %left PLOT %left TEXT SPRINTF /* give text adjustments higher precedence than TEXT, so that box "foo" above ljust == box ("foo" above ljust) */ %left LJUST RJUST ABOVE BELOW %left LEFT RIGHT /* Give attributes that take an optional expression a higher precedence than left and right, so that eg 'line chop left' parses properly. */ %left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED %left LABEL %left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST %left ORDINAL HERE '`' %left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */ /* these need to be lower than '-' */ %left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS /* these must have higher precedence than CHOP so that 'label %prec CHOP' works */ %left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C %left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER %left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END %left ',' %left OROR %left ANDAND %left EQUALEQUAL NOTEQUAL %left '<' '>' LESSEQUAL GREATEREQUAL %left BETWEEN OF %left AND %left '+' '-' %left '*' '/' '%' %right '!' %right '^' %% top: optional_separator | element_list ; element_list: optional_separator middle_element_list optional_separator ; middle_element_list: element | middle_element_list separator element ; optional_separator: /* empty */ | separator ; separator: ';' | separator ';' ; placeless_element: VARIABLE '=' any_expr | VARIABLE ':' '=' any_expr | UP | DOWN | LEFT | RIGHT | COMMAND_LINE | COMMAND print_args | PRINT print_args | SH {} DELIMITED | COPY TEXT | COPY TEXT THROUGH {} DELIMITED {} until | COPY THROUGH {} DELIMITED {} until | FOR VARIABLE '=' expr TO expr optional_by DO {} DELIMITED | simple_if | simple_if ELSE {} DELIMITED | reset_variables | RESET ; reset_variables: RESET VARIABLE | reset_variables VARIABLE | reset_variables ',' VARIABLE ; print_args: print_arg | print_args print_arg ; print_arg: expr %prec ',' | text | position %prec ',' ; simple_if: IF any_expr THEN {} DELIMITED ; until: /* empty */ | UNTIL TEXT ; any_expr: expr | text_expr ; text_expr: text EQUALEQUAL text | text NOTEQUAL text | text_expr ANDAND text_expr | text_expr ANDAND expr | expr ANDAND text_expr | text_expr OROR text_expr | text_expr OROR expr | expr OROR text_expr | '!' text_expr ; optional_by: /* empty */ | BY expr | BY '*' expr ; element: object_spec | LABEL ':' optional_separator element | LABEL ':' optional_separator position_not_place | LABEL ':' optional_separator place | '{' {} element_list '}' {} optional_element | placeless_element ; optional_element: /* empty */ | element ; object_spec: BOX | CIRCLE | ELLIPSE | ARC | LINE | ARROW | MOVE | SPLINE | text %prec TEXT | PLOT expr | PLOT expr text | '[' {} element_list ']' | object_spec HEIGHT expr | object_spec RADIUS expr | object_spec WIDTH expr | object_spec DIAMETER expr | object_spec expr %prec HEIGHT | object_spec UP | object_spec UP expr | object_spec DOWN | object_spec DOWN expr | object_spec RIGHT | object_spec RIGHT expr | object_spec LEFT | object_spec LEFT expr | object_spec FROM position | object_spec TO position | object_spec AT position | object_spec WITH path | object_spec WITH position %prec ',' | object_spec BY expr_pair | object_spec THEN | object_spec SOLID | object_spec DOTTED | object_spec DOTTED expr | object_spec DASHED | object_spec DASHED expr | object_spec FILL | object_spec FILL expr | object_spec SHADED text | object_spec COLORED text | object_spec OUTLINED text | object_spec CHOP | object_spec CHOP expr | object_spec SAME | object_spec INVISIBLE | object_spec LEFT_ARROW_HEAD | object_spec RIGHT_ARROW_HEAD | object_spec DOUBLE_ARROW_HEAD | object_spec CW | object_spec CCW | object_spec text %prec TEXT | object_spec LJUST | object_spec RJUST | object_spec ABOVE | object_spec BELOW | object_spec THICKNESS expr | object_spec ALIGNED ; text: TEXT | SPRINTF '(' TEXT sprintf_args ')' ; sprintf_args: /* empty */ | sprintf_args ',' expr ; position: position_not_place | place ; position_not_place: expr_pair | position '+' expr_pair | position '-' expr_pair | '(' position ',' position ')' | expr between position AND position | expr '<' position ',' position '>' ; between: BETWEEN | OF THE WAY BETWEEN ; expr_pair: expr ',' expr | '(' expr_pair ')' ; place: /* line at A left == line (at A) left */ label %prec CHOP | label corner | corner label | corner OF label | HERE ; label: LABEL | nth_primitive | label '.' LABEL ; ordinal: ORDINAL | '`' any_expr TH ; optional_ordinal_last: LAST | ordinal LAST ; nth_primitive: ordinal object_type | optional_ordinal_last object_type ; object_type: BOX | CIRCLE | ELLIPSE | ARC | LINE | ARROW | SPLINE | '[' ']' | TEXT ; label_path: '.' LABEL | label_path '.' LABEL ; relative_path: corner %prec CHOP /* give this a lower precedence than LEFT and RIGHT so that [A: box] with .A left == [A: box] with (.A left) */ | label_path %prec TEXT | label_path corner ; path: relative_path | '(' relative_path ',' relative_path ')' {} /* The rest of these rules are a compatibility sop. */ | ORDINAL LAST object_type relative_path | LAST object_type relative_path | ORDINAL object_type relative_path | LABEL relative_path ; corner: DOT_N | DOT_E | DOT_W | DOT_S | DOT_NE | DOT_SE | DOT_NW | DOT_SW | DOT_C | DOT_START | DOT_END | TOP | BOTTOM | LEFT | RIGHT | UPPER LEFT | LOWER LEFT | UPPER RIGHT | LOWER RIGHT | LEFT_CORNER | RIGHT_CORNER | UPPER LEFT_CORNER | LOWER LEFT_CORNER | UPPER RIGHT_CORNER | LOWER RIGHT_CORNER | NORTH | SOUTH | EAST | WEST | CENTER | START | END ; expr: VARIABLE | NUMBER | place DOT_X | place DOT_Y | place DOT_HT | place DOT_WID | place DOT_RAD | expr '+' expr | expr '-' expr | expr '*' expr | expr '/' expr | expr '%' expr | expr '^' expr | '-' expr %prec '!' | '(' any_expr ')' | SIN '(' any_expr ')' | COS '(' any_expr ')' | ATAN2 '(' any_expr ',' any_expr ')' | LOG '(' any_expr ')' | EXP '(' any_expr ')' | SQRT '(' any_expr ')' | K_MAX '(' any_expr ',' any_expr ')' | K_MIN '(' any_expr ',' any_expr ')' | INT '(' any_expr ')' | RAND '(' any_expr ')' | RAND '(' ')' | SRAND '(' any_expr ')' | expr '<' expr | expr LESSEQUAL expr | expr '>' expr | expr GREATEREQUAL expr | expr EQUALEQUAL expr | expr NOTEQUAL expr | expr ANDAND expr | expr OROR expr | '!' expr ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static int yylex (void) { static int const input[] = { VARIABLE, '=', LABEL, LEFT, DOT_X, 0 }; static int const *inputp = input; return *inputp++; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # In some versions of Autoconf, AT_CHECK invokes AS_ESCAPE before # expanding macros, so it corrupts some special characters in the # macros. To avoid this, expand now and pass it the result with proper # string quotation. Assume args 7 through 12 expand to properly quoted # strings. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:202.20: warning: empty rule without %empty [-Wempty-rule] input.y:270.7: warning: empty rule without %empty [-Wempty-rule] input.y:292.13: warning: empty rule without %empty [-Wempty-rule] input.y:309.18: warning: empty rule without %empty [-Wempty-rule] input.y:382.14: warning: empty rule without %empty [-Wempty-rule] input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother] input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence] input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence] input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence] input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence] input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence] input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence] input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence] input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for '\`', use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for '[', use %precedence [-Wprecedence] input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence] input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:202.20: warning: empty rule without %empty [-Wempty-rule] input.y:270.7: warning: empty rule without %empty [-Wempty-rule] input.y:292.13: warning: empty rule without %empty [-Wempty-rule] input.y:309.18: warning: empty rule without %empty [-Wempty-rule] input.y:382.14: warning: empty rule without %empty [-Wempty-rule] input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother] input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence] input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence] input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence] input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence] input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence] input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence] input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence] input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence] input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence] input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence] input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence] input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence] input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence] input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence] input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence] input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence] input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence] input.y:159.1-5: warning: useless associativity for '[', use %precedence [-Wprecedence] input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence] input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence] input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "existing.at:1460" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none" "existing.at:1460" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall --report=all,no-cex --header -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed -n 's/^State //p' input.output | tail -1" at_fn_check_prepare_notrace 'a shell pipeline' "existing.at:1460" ( $at_check_trace; sed -n 's/^State //p' input.output | tail -1 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "4833 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } # Canonical LR generates very large tables, resulting in very long # files with #line directives that may overflow what the standards # (C90 and C++98) guarantee: 32767. In that case, GCC's -pedantic # will issue an error. # # There is no "" around `wc` since some wc indent the result. if test 32767 -lt `wc -l < input.c`; then CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic / /'` CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic / /'` fi printf "%s\n" "existing.at:1460" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/existing.at:1460" { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "existing.at:1460" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "existing.at:1460" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/existing.at:1460: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "existing.at:1460" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/existing.at:1460" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_624 #AT_START_625 at_fn_group_banner 625 'regression.at:25' \ "Trivial grammars" " " 25 at_xfail=no ( printf "%s\n" "625. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ void yyerror (const char *msg); int yylex (void); #define YYSTYPE int * %} %define parse.error verbose %% program: 'x'; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:43: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:43" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:43" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:43: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:43" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:43" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:43: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:43" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:43" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:43: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:43" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:43" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:43: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:43" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:43" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:43: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:43" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:43" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:44" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:44" { set +x printf "%s\n" "$at_srcdir/regression.at:44: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "regression.at:44" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:44" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:45" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:45" { set +x printf "%s\n" "$at_srcdir/regression.at:45: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o -DYYDEBUG -c input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o -DYYDEBUG -c input.c " "regression.at:45" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o -DYYDEBUG -c input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:45" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_625 #AT_START_626 at_fn_group_banner 626 'regression.at:55' \ "YYSTYPE typedef" " " 25 at_xfail=no ( printf "%s\n" "626. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ void yyerror (const char *msg); int yylex (void); typedef union { char const *val; } YYSTYPE; %} %type program %% program: { $$ = ""; }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:73: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:73" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:73" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:73: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:73" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:73" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:73: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:73" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:73" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:73: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:73" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:73" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:73: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:73" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:73" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:73: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:73" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:73" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:74" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:74" { set +x printf "%s\n" "$at_srcdir/regression.at:74: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "regression.at:74" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:74" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_626 #AT_START_627 at_fn_group_banner 627 'regression.at:85' \ "Early token definitions with --yacc" " " 25 at_xfail=no ( printf "%s\n" "627. $at_setup_line: testing $at_desc ..." $at_traceon # Found in GCJ: they expect the tokens to be defined before the user # prologue, so that they can use the token definitions in it. # Not AT_DATA_GRAMMAR, which uses %code, which is not supported by Yacc. cat >input.y <<'_ATEOF' %{ void yyerror (const char *msg); int yylex (void); %} %union { int val; }; %{ #ifndef MY_TOKEN # error "MY_TOKEN not defined." #endif %} %token MY_TOKEN %% exp: MY_TOKEN; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:115: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --yacc -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:115" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --yacc -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:115" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:115: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --yacc -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --yacc -o input.c input.y" "regression.at:115" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --yacc -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:115" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:115: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:115" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:115" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:115: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:115" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:115" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:115: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:115" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:115" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:115: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --yacc -o input.c input.y" at_fn_check_prepare_trace "regression.at:115" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --yacc -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:115" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:116" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:116" { set +x printf "%s\n" "$at_srcdir/regression.at:116: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "regression.at:116" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:116" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_627 #AT_START_628 at_fn_group_banner 628 'regression.at:127' \ "Early token definitions without --yacc" " " 25 at_xfail=no ( printf "%s\n" "628. $at_setup_line: testing $at_desc ..." $at_traceon # Found in GCJ: they expect the tokens to be defined before the user # prologue, so that they can use the token definitions in it. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ void yyerror (const char *msg); int yylex (void); void print_my_token (void); %} %union { int val; }; %{ #include void print_my_token (void) { enum yytokentype tok1 = MY_TOKEN; yytoken_kind_t tok2 = MY_TOKEN; printf ("%d, %d\n", tok1, tok2); } %} %token MY_TOKEN %% exp: MY_TOKEN; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:161: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:161" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:161" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:161: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:161" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:161" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:161: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:161" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:161" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:161: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:161" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:161" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:161: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:161" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:161" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:161: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:161" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:161" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:162" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:162" { set +x printf "%s\n" "$at_srcdir/regression.at:162: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "regression.at:162" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:162" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_628 #AT_START_629 at_fn_group_banner 629 'regression.at:173' \ "Braces parsing" " " 25 at_xfail=no ( printf "%s\n" "629. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' /* Bison used to swallow the character after '}'. */ %% exp: { tests = {{{{{{{{{{}}}}}}}}}}; }; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:185: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:185" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:185" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:185: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" "regression.at:185" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:185" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:185: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:185" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:185" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:185: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:185" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:185" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:185: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:185" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:185" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:185: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y" at_fn_check_prepare_trace "regression.at:185" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:185" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:187: grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c" at_fn_check_prepare_trace "regression.at:187" ( $at_check_trace; grep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:187" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_629 #AT_START_630 at_fn_group_banner 630 'regression.at:196' \ "Rule Line Numbers" " " 25 at_xfail=no ( printf "%s\n" "630. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% expr: 'a' { } 'b' { } | { } 'c' { }; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:232: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c -v input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:232" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c -v input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:232" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:232: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -v input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -v input.y" "regression.at:232" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -v input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:232" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:232: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:232" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:232" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:232: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:232" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:232" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:232: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:232" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:232" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:232: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -v input.y" at_fn_check_prepare_trace "regression.at:232" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -v input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:232" $at_failed && at_fn_log_failure $at_traceon; } # Check the contents of the report. { set +x printf "%s\n" "$at_srcdir/regression.at:235: cat input.output" at_fn_check_prepare_trace "regression.at:235" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Grammar 0 \$accept: expr \$end 1 \$@1: %empty 2 expr: 'a' \$@1 'b' 3 \$@2: %empty 4 expr: \$@2 'c' Terminals, with rules where they appear \$end (0) 0 'a' (97) 2 'b' (98) 2 'c' (99) 4 error (256) Nonterminals, with rules where they appear \$accept (6) on left: 0 expr (7) on left: 2 4 on right: 0 \$@1 (8) on left: 1 on right: 2 \$@2 (9) on left: 3 on right: 4 State 0 0 \$accept: . expr \$end 'a' shift, and go to state 1 \$default reduce using rule 3 (\$@2) expr go to state 2 \$@2 go to state 3 State 1 2 expr: 'a' . \$@1 'b' \$default reduce using rule 1 (\$@1) \$@1 go to state 4 State 2 0 \$accept: expr . \$end \$end shift, and go to state 5 State 3 4 expr: \$@2 . 'c' 'c' shift, and go to state 6 State 4 2 expr: 'a' \$@1 . 'b' 'b' shift, and go to state 7 State 5 0 \$accept: expr \$end . \$default accept State 6 4 expr: \$@2 'c' . \$default reduce using rule 4 (expr) State 7 2 expr: 'a' \$@1 'b' . \$default reduce using rule 2 (expr) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:235" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_630 #AT_START_631 at_fn_group_banner 631 'regression.at:345' \ "Mixing %token styles" " " 25 at_xfail=no ( printf "%s\n" "631. $at_setup_line: testing $at_desc ..." $at_traceon # Taken from the documentation. cat >input.y <<'_ATEOF' %token OR "||" %token LE 134 "<=" %left OR "<=" %% exp: %empty; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v -Wall -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -Wall -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -Wall -o input.c input.y" "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:357: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:357" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:357: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:357" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:357: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:357" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -Wall -o input.c input.y" at_fn_check_prepare_trace "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:3.1-5: warning: useless precedence and associativity for \"||\" [-Wprecedence] input.y:3.1-5: warning: useless precedence and associativity for \"<=\" [-Wprecedence] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y -Werror" "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:3.1-5: warning: useless precedence and associativity for "||" [-Wprecedence] input.y:3.1-5: warning: useless precedence and associativity for "<=" [-Wprecedence] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/regression.at:357: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "regression.at:357" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y --warnings=error" "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y -Wnone,none -Werror --trace=none" "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:357: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y --warnings=none -Werror --trace=none" "regression.at:357" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -v -Wall -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:357" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_631 #AT_START_632 at_fn_group_banner 632 'regression.at:437' \ "Token definitions: parse.error=detailed" " " 25 at_xfail=no ( printf "%s\n" "632. $at_setup_line: testing $at_desc ..." $at_traceon # Clang chokes on some of our comments, because it tries to "parse" # some documentation directives in the comments: # # input.c:131:48: error: '\a' command does not have a valid word argument [-Werror,-Wdocumentation] # SPECIAL = 261 /* "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" */ # ~~^ cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #if defined __clang__ && 10 <= __clang_major__ # pragma clang diagnostic ignored "-Wdocumentation" #endif #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %define parse.error detailed %token MYEOF 0 "end of file" %token 'a' "a" // Bison managed, when fed with '%token 'f' "f"' to #define 'f'! %token B_TOKEN "b" %token C_TOKEN 'c' %token 'd' D_TOKEN %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" %% exp: "∃¬∩∪∀"; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Checking the warning message guarantees that the trigraph "??!" isn't # unnecessarily escaped here even though it would need to be if encoded in a # C-string literal. Also notice that unnecessary escaping, such as "\?", from # the user specification is eliminated. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:437: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:437" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:437: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:437" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:437: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:437" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_trace "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:26.8-14: warning: symbol SPECIAL redeclared [-Wother] 26 | %token SPECIAL \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" | ^~~~~~~ input.y:25.8-14: note: previous declaration 25 | %token SPECIAL \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" | ^~~~~~~ input.y:26.16-63: warning: symbol \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" used more than once as a literal string [-Wother] 26 | %token SPECIAL \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:26.8-14: warning: symbol SPECIAL redeclared [-Wother] 26 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" | ^~~~~~~ input.y:25.8-14: note: previous declaration 25 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" | ^~~~~~~ input.y:26.16-63: warning: symbol "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" used more than once as a literal string [-Wother] 26 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/regression.at:437: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "regression.at:437" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:437: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" "regression.at:437" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "regression.at:437" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:437" { set +x printf "%s\n" "$at_srcdir/regression.at:437: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:437" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } # Checking the error message here guarantees that yytname, which does contain # C-string literals, does have the trigraph escaped correctly. Thus, the # symbol name reported by the parser is exactly the same as that reported by # Bison itself. { set +x printf "%s\n" "$at_srcdir/regression.at:437: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:437" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:437: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:437" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected a, expecting ∃¬∩∪∀ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:437" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_632 #AT_START_633 at_fn_group_banner 633 'regression.at:438' \ "Token definitions: parse.error=verbose" " " 25 at_xfail=no ( printf "%s\n" "633. $at_setup_line: testing $at_desc ..." $at_traceon # Clang chokes on some of our comments, because it tries to "parse" # some documentation directives in the comments: # # input.c:131:48: error: '\a' command does not have a valid word argument [-Werror,-Wdocumentation] # SPECIAL = 261 /* "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" */ # ~~^ cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #if defined __clang__ && 10 <= __clang_major__ # pragma clang diagnostic ignored "-Wdocumentation" #endif #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %define parse.error verbose %token MYEOF 0 "end of file" %token 'a' "a" // Bison managed, when fed with '%token 'f' "f"' to #define 'f'! %token B_TOKEN "b" %token C_TOKEN 'c' %token 'd' D_TOKEN %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" %% exp: "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF # Checking the warning message guarantees that the trigraph "??!" isn't # unnecessarily escaped here even though it would need to be if encoded in a # C-string literal. Also notice that unnecessary escaping, such as "\?", from # the user specification is eliminated. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y" "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:438: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:438" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:438: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:438" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:438: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:438" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y" at_fn_check_prepare_trace "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:26.8-14: warning: symbol SPECIAL redeclared [-Wother] 26 | %token SPECIAL \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" | ^~~~~~~ input.y:25.8-14: note: previous declaration 25 | %token SPECIAL \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" | ^~~~~~~ input.y:26.16-63: warning: symbol \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" used more than once as a literal string [-Wother] 26 | %token SPECIAL \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror" "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:26.8-14: warning: symbol SPECIAL redeclared [-Wother] 26 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" | ^~~~~~~ input.y:25.8-14: note: previous declaration 25 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" | ^~~~~~~ input.y:26.16-63: warning: symbol "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" used more than once as a literal string [-Wother] 26 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/regression.at:438: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "regression.at:438" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error" "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none" "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:438: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none" "regression.at:438" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "regression.at:438" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:438" { set +x printf "%s\n" "$at_srcdir/regression.at:438: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:438" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } # Checking the error message here guarantees that yytname, which does contain # C-string literals, does have the trigraph escaped correctly. Thus, the # symbol name reported by the parser is exactly the same as that reported by # Bison itself. { set +x printf "%s\n" "$at_srcdir/regression.at:438: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:438" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:438: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:438" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected a, expecting \"\\\\\\'\\?\\\"\\a\\b\\f\\n\\r\\t\\v\\001\\201\\x001\\x000081??!\" " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:438" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_633 #AT_START_634 at_fn_group_banner 634 'regression.at:447' \ "Characters Escapes" " " 25 at_xfail=no ( printf "%s\n" "634. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ void yyerror (const char *msg); int yylex (void); %} %% exp: '\'' "\'" | '\"' "\"" | '"' "'" /* Pacify font-lock-mode: ". */ ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:465: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:465" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:465" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:465: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:465" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:465" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:465: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:465" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:465" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:465: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:465" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:465" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:465: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:465" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:465" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:465: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:465" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:465" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:466" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:466" { set +x printf "%s\n" "$at_srcdir/regression.at:466: \$CC \$CFLAGS \$CPPFLAGS -c -o input.o input.c " at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS -c -o input.o input.c " "regression.at:466" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS -c -o input.o input.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:466" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_634 #AT_START_635 at_fn_group_banner 635 'regression.at:480' \ "Web2c Report" " " 25 at_xfail=no ( printf "%s\n" "635. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token undef_id_tok const_id_tok %start CONST_DEC_PART %% CONST_DEC_PART: CONST_DEC_LIST ; CONST_DEC_LIST: CONST_DEC | CONST_DEC_LIST CONST_DEC ; CONST_DEC: { } undef_id_tok '=' const_id_tok ';' ; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:505: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:505" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:505" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:505: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v input.y" "regression.at:505" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:505" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:505: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:505" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:505" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:505: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:505" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:505" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:505: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:505" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:505" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:505: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v input.y" at_fn_check_prepare_trace "regression.at:505" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:505" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:506: cat input.output" at_fn_check_prepare_trace "regression.at:506" ( $at_check_trace; cat input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "Grammar 0 \$accept: CONST_DEC_PART \$end 1 CONST_DEC_PART: CONST_DEC_LIST 2 CONST_DEC_LIST: CONST_DEC 3 | CONST_DEC_LIST CONST_DEC 4 \$@1: %empty 5 CONST_DEC: \$@1 undef_id_tok '=' const_id_tok ';' Terminals, with rules where they appear \$end (0) 0 ';' (59) 5 '=' (61) 5 error (256) undef_id_tok (258) 5 const_id_tok (259) 5 Nonterminals, with rules where they appear \$accept (7) on left: 0 CONST_DEC_PART (8) on left: 1 on right: 0 CONST_DEC_LIST (9) on left: 2 3 on right: 1 3 CONST_DEC (10) on left: 5 on right: 2 3 \$@1 (11) on left: 4 on right: 5 State 0 0 \$accept: . CONST_DEC_PART \$end \$default reduce using rule 4 (\$@1) CONST_DEC_PART go to state 1 CONST_DEC_LIST go to state 2 CONST_DEC go to state 3 \$@1 go to state 4 State 1 0 \$accept: CONST_DEC_PART . \$end \$end shift, and go to state 5 State 2 1 CONST_DEC_PART: CONST_DEC_LIST . 3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC undef_id_tok reduce using rule 4 (\$@1) \$default reduce using rule 1 (CONST_DEC_PART) CONST_DEC go to state 6 \$@1 go to state 4 State 3 2 CONST_DEC_LIST: CONST_DEC . \$default reduce using rule 2 (CONST_DEC_LIST) State 4 5 CONST_DEC: \$@1 . undef_id_tok '=' const_id_tok ';' undef_id_tok shift, and go to state 7 State 5 0 \$accept: CONST_DEC_PART \$end . \$default accept State 6 3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC . \$default reduce using rule 3 (CONST_DEC_LIST) State 7 5 CONST_DEC: \$@1 undef_id_tok . '=' const_id_tok ';' '=' shift, and go to state 8 State 8 5 CONST_DEC: \$@1 undef_id_tok '=' . const_id_tok ';' const_id_tok shift, and go to state 9 State 9 5 CONST_DEC: \$@1 undef_id_tok '=' const_id_tok . ';' ';' shift, and go to state 10 State 10 5 CONST_DEC: \$@1 undef_id_tok '=' const_id_tok ';' . \$default reduce using rule 5 (CONST_DEC) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:506" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_635 #AT_START_636 at_fn_group_banner 636 'regression.at:661' \ "Web2c Actions" " " 25 at_xfail=no ( printf "%s\n" "636. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %% statement: struct_stat; struct_stat: %empty | if else; if: "if" "const" "then" statement; else: "else" statement; %% _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:674: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -v -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:674" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:674" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:674: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y" "regression.at:674" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:674" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:674: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:674" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:674" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:674: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:674" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:674" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:674: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:674" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:674" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:674: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y" at_fn_check_prepare_trace "regression.at:674" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -v -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:674" $at_failed && at_fn_log_failure $at_traceon; } # Check only the tables. sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p;/#define YY.*NINF/p' input.c >tables.c { set +x printf "%s\n" "$at_srcdir/regression.at:679: cat tables.c" at_fn_check_prepare_trace "regression.at:679" ( $at_check_trace; cat tables.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6 }; static const yytype_int8 yyrline[] = { 0, 2, 2, 3, 3, 4, 5 }; static const char *const yytname[] = { \"\\\"end of file\\\"\", \"error\", \"\\\"invalid token\\\"\", \"\\\"if\\\"\", \"\\\"const\\\"\", \"\\\"then\\\"\", \"\\\"else\\\"\", \"\$accept\", \"statement\", \"struct_stat\", \"if\", \"else\", YY_NULLPTR }; #define YYPACT_NINF (-8) #define YYTABLE_NINF (-1) static const yytype_int8 yypact[] = { -2, -1, 4, -8, 0, 2, -8, -2, -8, -2, -8, -8 }; static const yytype_int8 yydefact[] = { 3, 0, 0, 2, 0, 0, 1, 3, 4, 3, 6, 5 }; static const yytype_int8 yypgoto[] = { -8, -7, -8, -8, -8 }; static const yytype_int8 yydefgoto[] = { 0, 2, 3, 4, 8 }; static const yytype_int8 yytable[] = { 10, 1, 11, 5, 6, 0, 7, 9 }; static const yytype_int8 yycheck[] = { 7, 3, 9, 4, 0, -1, 6, 5 }; static const yytype_int8 yystos[] = { 0, 3, 8, 9, 10, 4, 0, 6, 11, 5, 8, 8 }; static const yytype_int8 yyr1[] = { 0, 7, 8, 9, 9, 10, 11 }; static const yytype_int8 yyr2[] = { 0, 2, 1, 0, 2, 4, 2 }; " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:679" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_636 #AT_START_637 at_fn_group_banner 637 'regression.at:812' \ "Useless Tokens" " " 25 at_xfail=no ( printf "%s\n" "637. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %token T00 T01 T02 T03 T04 T05 T06 T07 T08 T09 T10 T11 T12 T13 T14 T15 T16 T17 T18 T19 T20 T21 T22 T23 T24 T25 T26 T27 T28 T29 T30 T31 T32 T33 T34 T35 T36 T37 T38 T39 T40 T41 T42 T43 T44 T45 T46 T47 T48 T49 T50 T51 T52 T53 T54 T55 T56 T57 T58 T59 T60 T61 T62 T63 T64 T65 T66 T67 T68 T69 T70 T71 T72 T73 T74 T75 T76 T77 T78 T79 T80 T81 T82 T83 T84 T85 T86 T87 T88 T89 T90 %% n00: T00 n01; n01: T77 T88 n02 T89; n02: n03 n02 | %empty; n03: T16 T88 n04 T89 | T79 T88 n05 T89 | T78 T88 n06 T89 | T81 T88 n07 T89 | T82 T88 n05 T89 | T83 T88 n05 T89 | T84 T88 n05 T89 | T80 T88 n08 T89 | n09; n04: n10 n04 | %empty; n05: T58 | T61; n06: n10 n07: n05 | n11; n08: n12; n09: T30 T88 n05 T89; n11: n13 n11 | %empty; n13: T85 T88 n05 T89 | T86 T88 n08 T89; n10: n05; n14: %empty; n15: n16 T90 n15; n16: n17; n18: T58; n17: T07 T88 n19 T89; n19: n20; n20: n21 n20; n21: T13 T88 n22 T89; n22: n23; n24: n25; n25: n26 T90 n25 | n27 T90 n25; n26: n28; n28: T58; n29: n30 T90 n29; n30: T02 T88 n05 T89; n31: T04 T88 n32 T89; n33: n32; n32: n27 T90 n32; n27: T03 T88 n34 T89; n35: n36; n36: T05 T88 n34 T89 | n36 T06 T88 n34 T89; n34: n29 n33 n37; n37: T16 T88 n38 T89 T90; n38: n10 n38; n39: n05 | T58 T88 n05 T89; n40: n39; n41: n40 n41; n42: T48; n43: n42; n44: T59; n45: n44; n23: T59; n46: T60; n47: T60; n48: n05; n49: n05; n50: n49; n51: n49; n52: n05; n12: n05 n12 | %empty; n53: n05; n54: n05; n55: T15 T88 n05 T89; n56: T58; n57: n56; n58: T58; n59: T13 T88 n22 T89; n60: T75 T88 n22 T89; n61: T18 T88 n05 T89; n62: T76 T88 n46 T89; n63: n05 n63; n64: T14 T88 n22 T89; n65: T10 T88 n42 T89; n66: n05 n66; n67: T08 T88 n05 T89; n68: T11 T88 n42 T89; n69: T17 T88 n05 T89; n70: n71 n70; n71: T16 T88 n72 T89; n72: n10 n72; n73: T24 T88 n48 T89; n74: T12 T88 n05 T89; n75: T09 T88 n05 T89; n76: n05 n76; n77: T64 T88 n78 T89; n78: n79 n78; n79: T66 T88 n05 n40 T89; n80: n05 n80; n81: n82 n81; n82: T69 T88 n22 T89; n83: T47 T88 n05 T89; n84: T46 T88 T89; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:912: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-other -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:912" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-other -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:912" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:912: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -o input.c input.y" "regression.at:912" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-other -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:912" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:912: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:912" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:912" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:912: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:912" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:912" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:912: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:912" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:912" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:912: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -o input.c input.y" at_fn_check_prepare_trace "regression.at:912" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-other -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:912" $at_failed && at_fn_log_failure $at_traceon; } # Check only the tables. sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p;/#define YY.*NINF/p' input.c >tables.c { set +x printf "%s\n" "$at_srcdir/regression.at:917: cat tables.c" at_fn_check_prepare_trace "regression.at:917" ( $at_check_trace; cat tables.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93 }; static const yytype_int8 yyrline[] = { 0, 11, 11, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 21, 21, 22, 22, 23, 63, 63 }; static const char *const yytname[] = { \"\\\"end of file\\\"\", \"error\", \"\\\"invalid token\\\"\", \"T00\", \"T01\", \"T02\", \"T03\", \"T04\", \"T05\", \"T06\", \"T07\", \"T08\", \"T09\", \"T10\", \"T11\", \"T12\", \"T13\", \"T14\", \"T15\", \"T16\", \"T17\", \"T18\", \"T19\", \"T20\", \"T21\", \"T22\", \"T23\", \"T24\", \"T25\", \"T26\", \"T27\", \"T28\", \"T29\", \"T30\", \"T31\", \"T32\", \"T33\", \"T34\", \"T35\", \"T36\", \"T37\", \"T38\", \"T39\", \"T40\", \"T41\", \"T42\", \"T43\", \"T44\", \"T45\", \"T46\", \"T47\", \"T48\", \"T49\", \"T50\", \"T51\", \"T52\", \"T53\", \"T54\", \"T55\", \"T56\", \"T57\", \"T58\", \"T59\", \"T60\", \"T61\", \"T62\", \"T63\", \"T64\", \"T65\", \"T66\", \"T67\", \"T68\", \"T69\", \"T70\", \"T71\", \"T72\", \"T73\", \"T74\", \"T75\", \"T76\", \"T77\", \"T78\", \"T79\", \"T80\", \"T81\", \"T82\", \"T83\", \"T84\", \"T85\", \"T86\", \"T87\", \"T88\", \"T89\", \"T90\", \"\$accept\", \"n00\", \"n01\", \"n02\", \"n03\", \"n04\", \"n05\", \"n06\", \"n07\", \"n08\", \"n09\", \"n11\", \"n13\", \"n10\", \"n12\", YY_NULLPTR }; #define YYPACT_NINF (-78) #define YYTABLE_NINF (-1) static const yytype_int8 yypact[] = { -2, -77, 11, -73, -78, -78, -19, -71, -69, -68, -67, -66, -65, -64, -63, -62, -61, -19, -78, -49, -49, -49, -49, -49, -51, -49, -49, -49, -78, -78, -78, -78, -60, -78, -49, -59, -58, -78, -57, -49, -56, -78, -52, -48, -78, -50, -78, -72, -47, -46, -45, -78, -78, -78, -78, -78, -78, -78, -49, -49, -78, -78, -78, -78, -78, -44, -43, -78, -78 }; static const yytype_int8 yydefact[] = { 0, 0, 0, 0, 2, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 14, 16, 0, 0, 0, 30, 25, 0, 0, 0, 3, 4, 17, 18, 0, 28, 16, 0, 0, 19, 0, 30, 0, 22, 0, 0, 20, 0, 21, 25, 0, 0, 0, 6, 15, 23, 8, 7, 29, 13, 0, 30, 9, 24, 10, 11, 12, 0, 0, 26, 27 }; static const yytype_int8 yypgoto[] = { -78, -78, -78, 2, -78, -4, -18, -78, -78, -15, -78, 3, -78, 30, 13 }; static const yytype_int8 yydefgoto[] = { 0, 2, 4, 16, 17, 32, 33, 36, 45, 40, 18, 46, 47, 34, 41 }; static const yytype_int8 yytable[] = { 7, 1, 35, 3, 38, 39, 44, 48, 49, 50, 30, 5, 30, 31, 8, 31, 42, 43, 6, 29, 19, 39, 20, 21, 22, 23, 24, 25, 26, 27, 52, 28, 51, 53, 54, 55, 57, 42, 43, 58, 65, 39, 60, 59, 66, 62, 63, 64, 67, 68, 61, 37, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 11, 12, 13, 14, 15 }; static const yytype_int8 yycheck[] = { 19, 3, 20, 80, 22, 23, 24, 25, 26, 27, 61, 0, 61, 64, 33, 64, 88, 89, 91, 17, 91, 39, 91, 91, 91, 91, 91, 91, 91, 91, 34, 92, 92, 92, 92, 92, 92, 88, 89, 91, 58, 59, 92, 91, 59, 92, 92, 92, 92, 92, 47, 21, 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 82, 83, 84, 85, 86, 87 }; static const yytype_int8 yystos[] = { 0, 3, 95, 80, 96, 0, 91, 19, 33, 81, 82, 83, 84, 85, 86, 87, 97, 98, 104, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 97, 61, 64, 99, 100, 107, 100, 101, 107, 100, 100, 103, 108, 88, 89, 100, 102, 105, 106, 100, 100, 100, 92, 99, 92, 92, 92, 108, 92, 91, 91, 92, 105, 92, 92, 92, 100, 103, 92, 92 }; static const yytype_int8 yyr1[] = { 0, 94, 95, 96, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 105, 105, 106, 106, 107, 108, 108 }; static const yytype_int8 yyr2[] = { 0, 2, 2, 4, 2, 0, 4, 4, 4, 4, 4, 4, 4, 4, 1, 2, 0, 1, 1, 1, 1, 1, 1, 4, 2, 0, 4, 4, 1, 2, 0 }; " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:917" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_637 #AT_START_638 at_fn_group_banner 638 'regression.at:1143' \ "Dancer " " " 25 at_xfail=no ( printf "%s\n" "638. $at_setup_line: testing $at_desc ..." $at_traceon cat >dancer.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code provides { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token ARROW INVALID NUMBER STRING DATA %verbose %define parse.error verbose /* Grammar follows */ %% line: header body ; header: '<' from ARROW to '>' type ':' | '<' ARROW to '>' type ':' | ARROW to type ':' | type ':' | '<' '>' ; from: DATA | STRING | INVALID ; to: DATA | STRING | INVALID ; type: DATA | STRING | INVALID ; body: %empty | body member ; member: STRING | DATA | '+' NUMBER | '-' NUMBER | NUMBER | INVALID ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ":"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1143: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o dancer.c dancer.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1143" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o dancer.c dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1143: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.c dancer.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.c dancer.y" "regression.at:1143" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.c dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1143: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1143" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1143: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1143" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1143: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1143" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1143: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o dancer.c dancer.y" at_fn_check_prepare_trace "regression.at:1143" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o dancer.c dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1143" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1143" { set +x printf "%s\n" "$at_srcdir/regression.at:1143: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o dancer dancer.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS" "regression.at:1143" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1143: \$PREPARSER ./dancer" at_fn_check_prepare_dynamic " $PREPARSER ./dancer" "regression.at:1143" ( $at_check_trace; $PREPARSER ./dancer ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1143: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1143" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected ':' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1143" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_638 #AT_START_639 at_fn_group_banner 639 'regression.at:1144' \ "Dancer %glr-parser" " " 25 at_xfail=no ( printf "%s\n" "639. $at_setup_line: testing $at_desc ..." $at_traceon cat >dancer.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code provides { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %glr-parser %token ARROW INVALID NUMBER STRING DATA %verbose %define parse.error verbose /* Grammar follows */ %% line: header body ; header: '<' from ARROW to '>' type ':' | '<' ARROW to '>' type ':' | ARROW to type ':' | type ':' | '<' '>' ; from: DATA | STRING | INVALID ; to: DATA | STRING | INVALID ; type: DATA | STRING | INVALID ; body: %empty | body member ; member: STRING | DATA | '+' NUMBER | '-' NUMBER | NUMBER | INVALID ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ":"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1144: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o dancer.c dancer.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1144" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o dancer.c dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1144: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.c dancer.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.c dancer.y" "regression.at:1144" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.c dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1144: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1144" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1144: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1144" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1144: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1144" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1144: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o dancer.c dancer.y" at_fn_check_prepare_trace "regression.at:1144" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o dancer.c dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1144" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1144" { set +x printf "%s\n" "$at_srcdir/regression.at:1144: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o dancer dancer.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS" "regression.at:1144" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o dancer dancer.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1144: \$PREPARSER ./dancer" at_fn_check_prepare_dynamic " $PREPARSER ./dancer" "regression.at:1144" ( $at_check_trace; $PREPARSER ./dancer ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1144: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1144" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected ':' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1144" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_639 #AT_START_640 at_fn_group_banner 640 'regression.at:1145' \ "Dancer lalr1.cc" " " 25 at_xfail=no ( printf "%s\n" "640. $at_setup_line: testing $at_desc ..." $at_traceon cat >dancer.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code provides { static int yylex (yy::parser::value_type *lvalp); } %skeleton "lalr1.cc" %token ARROW INVALID NUMBER STRING DATA %verbose %define parse.error verbose /* Grammar follows */ %% line: header body ; header: '<' from ARROW to '>' type ':' | '<' ARROW to '>' type ':' | ARROW to type ':' | type ':' | '<' '>' ; from: DATA | STRING | INVALID ; to: DATA | STRING | INVALID ; type: DATA | STRING | INVALID ; body: %empty | body member ; member: STRING | DATA | '+' NUMBER | '-' NUMBER | NUMBER | INVALID ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ":"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1145: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o dancer.cc dancer.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1145" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o dancer.cc dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1145: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.cc dancer.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.cc dancer.y" "regression.at:1145" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o dancer.cc dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1145: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1145" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1145: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1145" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1145: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1145" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1145: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o dancer.cc dancer.y" at_fn_check_prepare_trace "regression.at:1145" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o dancer.cc dancer.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1145" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1145" { set +x printf "%s\n" "$at_srcdir/regression.at:1145: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o dancer dancer.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o dancer dancer.cc $LIBS" "regression.at:1145" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o dancer dancer.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1145: \$PREPARSER ./dancer" at_fn_check_prepare_dynamic " $PREPARSER ./dancer" "regression.at:1145" ( $at_check_trace; $PREPARSER ./dancer ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1145: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1145" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected ':' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1145" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_640 #AT_START_641 at_fn_group_banner 641 'regression.at:1220' \ "Expecting two tokens " " " 25 at_xfail=no ( printf "%s\n" "641. $at_setup_line: testing $at_desc ..." $at_traceon cat >expect2.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %define parse.error verbose %token A 1000 %token B %% program: %empty | program e ';' | program error ';'; e: e '+' t | t; t: A | B; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const tokens[] = { 1000, '+', '+', -1 }; static size_t toknum; assert (toknum < sizeof tokens / sizeof *tokens); return tokens[toknum++]; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o expect2.c expect2.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o expect2.c expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.c expect2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.c expect2.y" "regression.at:1220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.c expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1220: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1220" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1220: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1220" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1220: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1220" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1220: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o expect2.c expect2.y" at_fn_check_prepare_trace "regression.at:1220" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o expect2.c expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1220" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1220" { set +x printf "%s\n" "$at_srcdir/regression.at:1220: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o expect2 expect2.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS" "regression.at:1220" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1220: \$PREPARSER ./expect2" at_fn_check_prepare_dynamic " $PREPARSER ./expect2" "regression.at:1220" ( $at_check_trace; $PREPARSER ./expect2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1220: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1220" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '+', expecting A or B " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1220" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_641 #AT_START_642 at_fn_group_banner 642 'regression.at:1221' \ "Expecting two tokens %glr-parser" " " 25 at_xfail=no ( printf "%s\n" "642. $at_setup_line: testing $at_desc ..." $at_traceon cat >expect2.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ static int yylex (void); #include /* !POSIX */ static void yyerror (const char *msg); %} %glr-parser %define parse.error verbose %token A 1000 %token B %% program: %empty | program e ';' | program error ';'; e: e '+' t | t; t: A | B; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const tokens[] = { 1000, '+', '+', -1 }; static size_t toknum; assert (toknum < sizeof tokens / sizeof *tokens); return tokens[toknum++]; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1221: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o expect2.c expect2.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1221" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o expect2.c expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1221: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.c expect2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.c expect2.y" "regression.at:1221" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.c expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1221: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1221" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1221: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1221" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1221: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1221" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1221: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o expect2.c expect2.y" at_fn_check_prepare_trace "regression.at:1221" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o expect2.c expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1221" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1221" { set +x printf "%s\n" "$at_srcdir/regression.at:1221: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o expect2 expect2.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS" "regression.at:1221" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o expect2 expect2.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1221: \$PREPARSER ./expect2" at_fn_check_prepare_dynamic " $PREPARSER ./expect2" "regression.at:1221" ( $at_check_trace; $PREPARSER ./expect2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1221: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1221" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '+', expecting A or B " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1221" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_642 #AT_START_643 at_fn_group_banner 643 'regression.at:1222' \ "Expecting two tokens lalr1.cc" " " 25 at_xfail=no ( printf "%s\n" "643. $at_setup_line: testing $at_desc ..." $at_traceon cat >expect2.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ static int yylex (int *); #include %} %skeleton "lalr1.cc" %define parse.error verbose %token A 1000 %token B %% program: %empty | program e ';' | program error ';'; e: e '+' t | t; t: A | B; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } int yyparse () { yy::parser parser; return parser.parse (); } #include static int yylex (int *lval) { static int const tokens[] = { 1000, '+', '+', -1 }; static size_t toknum; *lval = 0; /* Pacify GCC. */ assert (toknum < sizeof tokens / sizeof *tokens); return tokens[toknum++]; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1222: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o expect2.cc expect2.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1222" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o expect2.cc expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1222: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.cc expect2.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.cc expect2.y" "regression.at:1222" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o expect2.cc expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1222: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1222" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1222: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1222" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1222: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1222" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1222: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o expect2.cc expect2.y" at_fn_check_prepare_trace "regression.at:1222" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o expect2.cc expect2.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1222" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1222" { set +x printf "%s\n" "$at_srcdir/regression.at:1222: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o expect2 expect2.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o expect2 expect2.cc $LIBS" "regression.at:1222" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o expect2 expect2.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1222: \$PREPARSER ./expect2" at_fn_check_prepare_dynamic " $PREPARSER ./expect2" "regression.at:1222" ( $at_check_trace; $PREPARSER ./expect2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1222: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1222" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected '+', expecting A or B " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1222" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_643 #AT_START_644 at_fn_group_banner 644 'regression.at:1230' \ "Braced code in declaration in rules section" " " 25 at_xfail=no ( printf "%s\n" "644. $at_setup_line: testing $at_desc ..." $at_traceon # Bison once mistook braced code in a declaration in the rules section to be a # rule action. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %debug %define parse.error verbose %% start: { printf ("Bison would once convert this action to a midrule because of the" " subsequent braced code.\n"); } ; %destructor { fprintf (stderr, "DESTRUCTOR\n"); } 'a'; %printer { fprintf (yyo, "PRINTER"); } 'a'; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1261" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1261" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1261: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1261" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1261" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1261: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1261" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1261" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1261: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1261" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1261" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1261: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1261" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1261" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1262" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1262" { set +x printf "%s\n" "$at_srcdir/regression.at:1262: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1262" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1262" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1263: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "regression.at:1263" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Bison would once convert this action to a midrule because of the subsequent braced code. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1263" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1263: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1263" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reducing stack by rule 1 (line 20): -> \$\$ = nterm start () Entering state 1 Stack now 0 1 Reading a token Next token is token 'a' (PRINTER) syntax error, unexpected 'a', expecting end of file Error: popping nterm start () Stack now 0 Cleanup: discarding lookahead token 'a' (PRINTER) DESTRUCTOR Stack now 0 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1263" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_644 #AT_START_645 at_fn_group_banner 645 'regression.at:1291' \ "String alias declared after use" " " 25 at_xfail=no ( printf "%s\n" "645. $at_setup_line: testing $at_desc ..." $at_traceon # Bison once incorrectly asserted that the symbol number for either a token or # its alias was the highest symbol number so far at the point of the alias # declaration. That was true unless the declaration appeared after their first # uses and other tokens appeared in between. cat >input.y <<'_ATEOF' %% start: 'a' "A" 'b'; %token 'a' "A"; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1304: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1304" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1304" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1304: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1304" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1304" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1304: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1304" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1304" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1304: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1304" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1304" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1304: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1304" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1304" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1304: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1304" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1304" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_645 #AT_START_646 at_fn_group_banner 646 'regression.at:1314' \ "Extra lookahead sets in report" " " 25 at_xfail=no ( printf "%s\n" "646. $at_setup_line: testing $at_desc ..." $at_traceon # Bison prints each reduction's lookahead set only next to the associated # state's one item that (1) is associated with the same rule as the reduction # and (2) has its dot at the end of its RHS. Previously, Bison also # erroneously printed the lookahead set next to all of the state's other items # associated with the same rule. This bug affected only the '.output' file and # not the generated parser source code. cat >input.y <<'_ATEOF' %% start: a | 'a' a 'a' ; a: 'a' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv --report=all input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1329" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all input.y" "regression.at:1329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1329" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1329: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1329" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1329" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1329: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1329" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1329" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1329: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1329" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1329" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1329: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all input.y" at_fn_check_prepare_trace "regression.at:1329" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret --report=all input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1329" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1330: sed -n '/^State 1\$/,/^State 2\$/p' input.output" at_fn_check_prepare_dynamic "sed -n '/^State 1$/,/^State 2$/p' input.output" "regression.at:1330" ( $at_check_trace; sed -n '/^State 1$/,/^State 2$/p' input.output ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "State 1 2 start: 'a' . a 'a' 3 a: . 'a' 3 | 'a' . [\$end] 'a' shift, and go to state 4 \$default reduce using rule 3 (a) a go to state 5 State 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1330" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_646 #AT_START_647 at_fn_group_banner 647 'regression.at:1355' \ "Token number in precedence declaration" " " 25 at_xfail=no ( printf "%s\n" "647. $at_setup_line: testing $at_desc ..." $at_traceon # POSIX says token numbers can be declared in %left, %right, and %nonassoc, but # we lost this in Bison 1.50. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.error verbose %token TK_ALIAS 3 "tok alias" %right END 0 %left TK1 1 TK2 2 "tok alias" %% start: TK1 sr_conflict "tok alias" | start %prec END ; sr_conflict: TK2 | TK2 "tok alias" ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = { 1, 2, 3, 0 }; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wall -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall -o input.c input.y" "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1388: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1388" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1388: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1388" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1388: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1388" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall -o input.c input.y" at_fn_check_prepare_trace "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wall -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother] input.y:28.5-19: warning: rule useless in parser due to conflicts [-Wother] input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence] " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Werror" "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother] input.y:28.5-19: warning: rule useless in parser due to conflicts [-Wother] input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence] _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/regression.at:1388: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "regression.at:1388" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=error" "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Wnone,none -Werror --trace=none" "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1388: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=none -Werror --trace=none" "regression.at:1388" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -Wall -o input.c input.y --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1388" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi printf "%s\n" "regression.at:1393" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1393" { set +x printf "%s\n" "$at_srcdir/regression.at:1393: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1393" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1393" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1394: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1394" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1394" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1394: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1394" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1394" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_647 #AT_START_648 at_fn_group_banner 648 'regression.at:1408' \ "parse-gram.y: LALR = IELR" " " 25 at_xfail=no ( printf "%s\n" "648. $at_setup_line: testing $at_desc ..." $at_traceon # Avoid tests/bison's dark magic by processing a local copy of the # grammar. Avoid differences in synclines by telling bison that the # output files have the same name. cp $abs_top_srcdir/src/parse-gram.y input.y if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c -Dlr.type=lalr input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c -Dlr.type=lalr input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1414" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -Dlr.type=lalr input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -Dlr.type=lalr input.y" "regression.at:1414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -Dlr.type=lalr input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1414" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1414: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1414" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1414" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1414: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1414" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1414" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1414: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1414" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1414" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1414: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -Dlr.type=lalr input.y" at_fn_check_prepare_trace "regression.at:1414" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -Dlr.type=lalr input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1414" $at_failed && at_fn_log_failure $at_traceon; } mv input.c lalr.c if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c -Dlr.type=ielr input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c -Dlr.type=ielr input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1417" $at_failed && at_fn_log_failure \ "lalr.c" $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -Dlr.type=ielr input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -Dlr.type=ielr input.y" "regression.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c -Dlr.type=ielr input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1417" $at_failed && at_fn_log_failure \ "lalr.c" $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1417: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1417" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1417" $at_failed && at_fn_log_failure \ "lalr.c" $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1417: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1417" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1417" $at_failed && at_fn_log_failure \ "lalr.c" $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1417: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1417" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1417" $at_failed && at_fn_log_failure \ "lalr.c" $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1417: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -Dlr.type=ielr input.y" at_fn_check_prepare_trace "regression.at:1417" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c -Dlr.type=ielr input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1417" $at_failed && at_fn_log_failure \ "lalr.c" $at_traceon; } mv input.c ielr.c { set +x printf "%s\n" "$at_srcdir/regression.at:1420: diff lalr.c ielr.c" at_fn_check_prepare_trace "regression.at:1420" ( $at_check_trace; diff lalr.c ielr.c ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1420" $at_failed && at_fn_log_failure \ "lalr.c" \ "ielr.c" $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_648 #AT_START_649 at_fn_group_banner 649 'regression.at:1430' \ "parse.error=verbose and YYSTACK_USE_ALLOCA" " " 25 at_xfail=no ( printf "%s\n" "649. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define YYSTACK_USE_ALLOCA 1 } %define parse.error verbose %% start: check syntax_error syntax_error ; check: { if (128 < sizeof yymsgbuf) { fprintf (stderr, "The initial size of yymsgbuf in yyparse has increased\n" "since this test group was last updated. As a result,\n" "this test group may no longer manage to induce a\n" "reallocation of the syntax error message buffer.\n" "This test group must be adjusted to produce a longer\n" "error message.\n"); YYABORT; } } ; // Induce a syntax error message whose total length is more than // sizeof yymsgbuf in yyparse. Each token here is 64 bytes. syntax_error: "123456789112345678921234567893123456789412345678951234567896123A" | "123456789112345678921234567893123456789412345678951234567896123B" | error 'a' 'b' 'c' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /* Induce two syntax error messages (which requires full error recovery by shifting 3 tokens) in order to detect any loss of the reallocated buffer. */ #include static int yylex (void) { static char const input[] = "abc"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1481: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1481" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1481" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1481: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1481" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1481" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1481: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1481" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1481" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1481: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1481" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1481" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1481: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1481" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1481" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1481: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1481" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1481" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1482" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1482" { set +x printf "%s\n" "$at_srcdir/regression.at:1482: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1482" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1483: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1483" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1483" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1483: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1483" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting 123456789112345678921234567893123456789412345678951234567896123A or 123456789112345678921234567893123456789412345678951234567896123B syntax error, unexpected end of file, expecting 123456789112345678921234567893123456789412345678951234567896123A or 123456789112345678921234567893123456789412345678951234567896123B " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1483" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_649 #AT_START_650 at_fn_group_banner 650 'regression.at:1504' \ "parse.error=verbose overflow" " " 25 at_xfail=no ( printf "%s\n" "650. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); /* This prevents this test case from having to induce error messages large enough to overflow size_t. */ #define YYSIZE_T unsigned char /* Bring in malloc and set EXIT_SUCCESS so yacc.c doesn't try to provide a malloc prototype using our YYSIZE_T. */ #include #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 #endif /* Max depth is usually much smaller than YYSTACK_ALLOC_MAXIMUM, and we don't want gcc to warn everywhere this constant would be too big to make sense for our YYSIZE_T. */ #define YYMAXDEPTH 100 } %define parse.error verbose %% start: syntax_error1 check syntax_error2 check syntax_error3; // Induce a syntax error message whose total length causes yymsg in // yyparse to be reallocated to size YYSTACK_ALLOC_MAXIMUM, which // should be 255. Each token here is 64 bytes. syntax_error1: "123456789112345678921234567893123456789412345678951234567896123A" | "123456789112345678921234567893123456789412345678951234567896123B" | "123456789112345678921234567893123456789412345678951234567896123C" | error 'a' 'b' 'c' ; check: { if (yymsg_alloc != YYSTACK_ALLOC_MAXIMUM || YYSTACK_ALLOC_MAXIMUM != YYSIZE_MAXIMUM || YYSIZE_MAXIMUM != 255) { fprintf (stderr, "The assumptions of this test group are no longer\n" "valid, so it may no longer catch the error it was\n" "designed to catch. Specifically, the following\n" "values should all be 255:\n\n"); fprintf (stderr, " yymsg_alloc = %d\n", yymsg_alloc); fprintf (stderr, " YYSTACK_ALLOC_MAXIMUM = %d\n", YYSTACK_ALLOC_MAXIMUM); fprintf (stderr, " YYSIZE_MAXIMUM = %d\n", YYSIZE_MAXIMUM); YYABORT; } } ; // We used to overflow memory here because the first four "expected" // tokens plus rest of the error message is greater that 255 bytes. // However there are *five* expected tokens here, so anyway we will // *not* display these tokens. So the message fits, no overflow. syntax_error2: "123456789112345678921234567893123456789412345678951234567896123A" | "123456789112345678921234567893123456789412345678951234567896123B" | "123456789112345678921234567893123456789412345678951234567896123C" | "123456789112345678921234567893123456789412345678951234567896123D" | "123456789112345678921234567893123456789412345678951234567896123E" | error 'd' 'e' 'f' ; // Now overflow. syntax_error3: "123456789112345678921234567893123456789412345678951234567896123A" | "123456789112345678921234567893123456789412345678951234567896123B" | "123456789112345678921234567893123456789412345678951234567896123C" | "123456789112345678921234567893123456789412345678951234567896123D" ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } /* Induce two syntax error messages (which requires full error recovery by shifting 3 tokens). */ #include static int yylex (void) { static char const input[] = "abcdef"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { /* Push parsers throw away the message buffer between tokens, so skip this test under maintainer-push-check. */ if (YYPUSH) return 77; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1604: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1604" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1604" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1604: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1604" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1604" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1604: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1604" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1604" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1604: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1604" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1604" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1604: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1604" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1604" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1604: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1604" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1604" $at_failed && at_fn_log_failure $at_traceon; } # gcc warns about tautologies and fallacies involving comparisons for # unsigned char. However, it doesn't produce these same warnings for # size_t and many other types when the warnings would seem to make just # as much sense. We ignore the warnings. CFLAGS="$NO_WERROR_CFLAGS" printf "%s\n" "regression.at:1611" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1611" { set +x printf "%s\n" "$at_srcdir/regression.at:1611: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1611" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1611" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1613: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1613" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/regression.at:1613" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1613: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1613" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'a', expecting 123456789112345678921234567893123456789412345678951234567896123A or 123456789112345678921234567893123456789412345678951234567896123B or 123456789112345678921234567893123456789412345678951234567896123C syntax error, unexpected 'd' syntax error memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1613" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_650 #AT_START_651 at_fn_group_banner 651 'regression.at:1628' \ "LAC: Exploratory stack" " " 25 at_xfail=no ( printf "%s\n" "651. $at_setup_line: testing $at_desc ..." $at_traceon # C. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* printf */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %debug %define api.push-pull pull %define parse.error verbose %token 'c' %expect 21 %% // default reductions in inconsistent states // v v v v v v v v v v v v v v S: A B A A B A A A A B A A A A A A A B C C A A A A A A A A A A A A B ; // ^ ^ ^ // LAC reallocs A: 'a' | %empty { printf ("inconsistent default reduction\n"); } ; B: 'b' ; C: %empty { printf ("consistent default reduction\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "bbbbc"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1713: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1713" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1713: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1713" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1713" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1713: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1713" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1713" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1713: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1713" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1713" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1713" { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1713" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \$PREPARSER ./input --debug > stdout.txt 2> stderr.txt" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug > stdout.txt 2> stderr.txt" "regression.at:1713" ( $at_check_trace; $PREPARSER ./input --debug > stdout.txt 2> stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1713: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1713" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } # Make sure syntax error doesn't forget that 'a' is expected. It would # be forgotten without lookahead correction. { set +x printf "%s\n" "$at_srcdir/regression.at:1713: grep 'syntax error,' stderr.txt" at_fn_check_prepare_trace "regression.at:1713" ( $at_check_trace; grep 'syntax error,' stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "syntax error, unexpected 'c', expecting 'a' or 'b' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } # Check number of default reductions in inconsistent states to be sure # syntax error is detected before unnecessary reductions are performed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \"\$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" "regression.at:1713" ( $at_check_trace; "$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "14" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of default reductions in consistent states to be sure # it is performed before the syntax error is detected. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \"\$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" "regression.at:1713" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of reallocs to be sure reallocated memory isn't somehow # lost between LAC invocations. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1713: \"\$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" "regression.at:1713" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\(realloc//g;' < stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "3" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1713" $at_failed && at_fn_log_failure $at_traceon; } fi cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* printf */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %debug %define api.push-pull pull %define api.pure %define parse.error verbose %token 'c' %expect 21 %% // default reductions in inconsistent states // v v v v v v v v v v v v v v S: A B A A B A A A A B A A A A A A A B C C A A A A A A A A A A A A B ; // ^ ^ ^ // LAC reallocs A: 'a' | %empty { printf ("inconsistent default reduction\n"); } ; B: 'b' ; C: %empty { printf ("consistent default reduction\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "bbbbc"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1714: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1714" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1714: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1714" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1714" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1714: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1714" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1714" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1714: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1714" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1714" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1714" { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1714" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \$PREPARSER ./input --debug > stdout.txt 2> stderr.txt" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug > stdout.txt 2> stderr.txt" "regression.at:1714" ( $at_check_trace; $PREPARSER ./input --debug > stdout.txt 2> stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1714: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1714" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } # Make sure syntax error doesn't forget that 'a' is expected. It would # be forgotten without lookahead correction. { set +x printf "%s\n" "$at_srcdir/regression.at:1714: grep 'syntax error,' stderr.txt" at_fn_check_prepare_trace "regression.at:1714" ( $at_check_trace; grep 'syntax error,' stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "syntax error, unexpected 'c', expecting 'a' or 'b' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } # Check number of default reductions in inconsistent states to be sure # syntax error is detected before unnecessary reductions are performed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \"\$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" "regression.at:1714" ( $at_check_trace; "$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "14" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of default reductions in consistent states to be sure # it is performed before the syntax error is detected. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \"\$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" "regression.at:1714" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of reallocs to be sure reallocated memory isn't somehow # lost between LAC invocations. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1714: \"\$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" "regression.at:1714" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\(realloc//g;' < stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "3" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1714" $at_failed && at_fn_log_failure $at_traceon; } fi cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* printf */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %debug %define api.push-pull both %define parse.error verbose %token 'c' %expect 21 %% // default reductions in inconsistent states // v v v v v v v v v v v v v v S: A B A A B A A A A B A A A A A A A B C C A A A A A A A A A A A A B ; // ^ ^ ^ // LAC reallocs A: 'a' | %empty { printf ("inconsistent default reduction\n"); } ; B: 'b' ; C: %empty { printf ("consistent default reduction\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "bbbbc"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1715: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1715" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1715: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1715" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1715" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1715: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1715" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1715" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1715: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1715" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1715" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1715" { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1715" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \$PREPARSER ./input --debug > stdout.txt 2> stderr.txt" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug > stdout.txt 2> stderr.txt" "regression.at:1715" ( $at_check_trace; $PREPARSER ./input --debug > stdout.txt 2> stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1715: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1715" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } # Make sure syntax error doesn't forget that 'a' is expected. It would # be forgotten without lookahead correction. { set +x printf "%s\n" "$at_srcdir/regression.at:1715: grep 'syntax error,' stderr.txt" at_fn_check_prepare_trace "regression.at:1715" ( $at_check_trace; grep 'syntax error,' stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "syntax error, unexpected 'c', expecting 'a' or 'b' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } # Check number of default reductions in inconsistent states to be sure # syntax error is detected before unnecessary reductions are performed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \"\$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" "regression.at:1715" ( $at_check_trace; "$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "14" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of default reductions in consistent states to be sure # it is performed before the syntax error is detected. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \"\$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" "regression.at:1715" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of reallocs to be sure reallocated memory isn't somehow # lost between LAC invocations. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1715: \"\$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" "regression.at:1715" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\(realloc//g;' < stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "3" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1715" $at_failed && at_fn_log_failure $at_traceon; } fi cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* printf */ #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %debug %define api.push-pull both %define api.pure %define parse.error verbose %token 'c' %expect 21 %% // default reductions in inconsistent states // v v v v v v v v v v v v v v S: A B A A B A A A A B A A A A A A A B C C A A A A A A A A A A A A B ; // ^ ^ ^ // LAC reallocs A: 'a' | %empty { printf ("inconsistent default reduction\n"); } ; B: 'b' ; C: %empty { printf ("consistent default reduction\n"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (YYSTYPE *lvalp) { static char const input[] = "bbbbc"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1716: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1716" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1716: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1716" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1716" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1716: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1716" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1716" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1716: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \\ -Dparse.lac.es-capacity-initial=1 \\ -Dparse.lac.memory-trace=full -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1716" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full \ -Dparse.lac.es-capacity-initial=1 \ -Dparse.lac.memory-trace=full -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1716" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1716" { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1716" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \$PREPARSER ./input --debug > stdout.txt 2> stderr.txt" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug > stdout.txt 2> stderr.txt" "regression.at:1716" ( $at_check_trace; $PREPARSER ./input --debug > stdout.txt 2> stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1716: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1716" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } # Make sure syntax error doesn't forget that 'a' is expected. It would # be forgotten without lookahead correction. { set +x printf "%s\n" "$at_srcdir/regression.at:1716: grep 'syntax error,' stderr.txt" at_fn_check_prepare_trace "regression.at:1716" ( $at_check_trace; grep 'syntax error,' stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "syntax error, unexpected 'c', expecting 'a' or 'b' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } # Check number of default reductions in inconsistent states to be sure # syntax error is detected before unnecessary reductions are performed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \"\$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" "regression.at:1716" ( $at_check_trace; "$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "14" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of default reductions in consistent states to be sure # it is performed before the syntax error is detected. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \"\$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" "regression.at:1716" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of reallocs to be sure reallocated memory isn't somehow # lost between LAC invocations. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1716: \"\$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\(realloc//g;' < stderr.txt" "regression.at:1716" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\(realloc//g;' < stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "3" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1716" $at_failed && at_fn_log_failure $at_traceon; } fi # C++. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* printf */ static int yylex (yy::parser::value_type *lvalp); } %debug %skeleton "lalr1.cc" %define parse.error verbose %token 'c' %expect 21 %% // default reductions in inconsistent states // v v v v v v v v v v v v v v S: A B A A B A A A A B A A A A A A A B C C A A A A A A A A A A A A B ; // ^ ^ ^ // LAC reallocs A: 'a' | %empty { printf ("inconsistent default reduction\n"); } ; B: 'b' ; C: %empty { printf ("consistent default reduction\n"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "bbbbc"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1719: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1719" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1719: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.cc input.y" "regression.at:1719" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1719: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1719" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1719: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1719" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1719: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1719" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1719: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -o input.cc input.y" at_fn_check_prepare_trace "regression.at:1719" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1719" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1719" { set +x printf "%s\n" "$at_srcdir/regression.at:1719: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "regression.at:1719" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1719: \$PREPARSER ./input --debug > stdout.txt 2> stderr.txt" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug > stdout.txt 2> stderr.txt" "regression.at:1719" ( $at_check_trace; $PREPARSER ./input --debug > stdout.txt 2> stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1719: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1719" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } # Make sure syntax error doesn't forget that 'a' is expected. It would # be forgotten without lookahead correction. { set +x printf "%s\n" "$at_srcdir/regression.at:1719: grep 'syntax error,' stderr.txt" at_fn_check_prepare_trace "regression.at:1719" ( $at_check_trace; grep 'syntax error,' stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "syntax error, unexpected 'c', expecting 'a' or 'b' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } # Check number of default reductions in inconsistent states to be sure # syntax error is detected before unnecessary reductions are performed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1719: \"\$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" "regression.at:1719" ( $at_check_trace; "$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "14" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of default reductions in consistent states to be sure # it is performed before the syntax error is detected. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1719: \"\$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" "regression.at:1719" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1719" $at_failed && at_fn_log_failure $at_traceon; } fi # D. # FIXME: does not work. lalr1.d cannot work with literal chars, # and AT_YYLEX_DEFINE(d) is incorrect. # AT_LAC_CHECK([[%skeleton "lalr1.d"]]) # Java. cat >input.y <<'_ATEOF' %code imports { import java.io.IOException; } %code lexer { public void yyerror (String m) { System.err.println (m); } /*--------. | yylex. | `--------*/ public String input = "bbbbc"; public int index = 0; public int yylex() { if (index < input.length()) return input.charAt(index++); else return 0; } public Object getLVal() { return null; } }; %debug %skeleton "lalr1.java" %define parse.error verbose %token 'c' %expect 21 %% // default reductions in inconsistent states // v v v v v v v v v v v v v v S: A B A A B A A A A B A A A A A A A B C C A A A A A A A A A A A A B ; // ^ ^ ^ // LAC reallocs A: 'a' | %empty { System.out.print ("inconsistent default reduction\n"); } ; B: 'b' ; C: %empty { System.out.print ("consistent default reduction\n"); } ; %% class input { public static void main(String[] args) throws IOException { YYParser p = new YYParser(); boolean success = p.parse(); if (!success) System.exit(1); } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full -o input.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.java input.y" "regression.at:1727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1727: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1727" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1727: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1727" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1727: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1727" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1727: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -o input.java input.y" at_fn_check_prepare_trace "regression.at:1727" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -o input.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1727" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1727" printf "%s\n" "regression.at:1727" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1727" { set +x printf "%s\n" "$at_srcdir/regression.at:1727: \$SHELL ../../../javacomp.sh input.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh input.java" "regression.at:1727" ( $at_check_trace; $SHELL ../../../javacomp.sh input.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1727: \$SHELL ../../../javaexec.sh input --debug > stdout.txt 2> stderr.txt" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh input --debug > stdout.txt 2> stderr.txt" "regression.at:1727" ( $at_check_trace; $SHELL ../../../javaexec.sh input --debug > stdout.txt 2> stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } # Make sure syntax error doesn't forget that 'a' is expected. It would # be forgotten without lookahead correction. { set +x printf "%s\n" "$at_srcdir/regression.at:1727: grep 'syntax error,' stderr.txt" at_fn_check_prepare_trace "regression.at:1727" ( $at_check_trace; grep 'syntax error,' stderr.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "syntax error, unexpected 'c', expecting 'a' or 'b' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } # Check number of default reductions in inconsistent states to be sure # syntax error is detected before unnecessary reductions are performed. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1727: \"\$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt" "regression.at:1727" ( $at_check_trace; "$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "14" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } fi # Check number of default reductions in consistent states to be sure # it is performed before the syntax error is detected. if test x"$PERL" != x; then { set +x printf "%s\n" "$at_srcdir/regression.at:1727: \"\$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" at_fn_check_prepare_dynamic "\"$PERL\" -0777 -ne 'print s/\\bconsistent default reduction//g;' stdout.txt" "regression.at:1727" ( $at_check_trace; "$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' stdout.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1727" $at_failed && at_fn_log_failure $at_traceon; } fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_651 #AT_START_652 at_fn_group_banner 652 'regression.at:1739' \ "LAC: Memory exhaustion" " " 25 at_xfail=no ( printf "%s\n" "652. $at_setup_line: testing $at_desc ..." $at_traceon # Check for memory exhaustion during parsing. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define YYMAXDEPTH 8 } %debug %define parse.error verbose %expect 8 %% S: A A A A A A A A A ; A: %empty | 'a' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1771: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1771" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1771: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" "regression.at:1771" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1771: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1771" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1771: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1771" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1771: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1771" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1771: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" at_fn_check_prepare_trace "regression.at:1771" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1771" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1771" { set +x printf "%s\n" "$at_srcdir/regression.at:1771: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1771" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1771" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1771" { set +x printf "%s\n" "$at_srcdir/regression.at:1771: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1771" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1771" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1772: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "regression.at:1772" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/regression.at:1772" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1772: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1772" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reading a token Now at end of input. LAC: initial context established for \"end of file\" LAC: checking lookahead \"end of file\": R2 G3 R2 G5 R2 G6 R2 G7 R2 G8 R2 G9 R2 G10 R2 G11 R2 (max size exceeded) memory exhausted Cleanup: discarding lookahead token \"end of file\" () Stack now 0 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1772" $at_failed && at_fn_log_failure $at_traceon; } # Induce an immediate syntax error with an undefined token, and check # for memory exhaustion while building syntax error message. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define YYMAXDEPTH 8 } %debug %define parse.error verbose %expect 8 %% S: A A A A A A A A A ; A: %empty | 'a' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "z"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1787: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1787" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1787: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" "regression.at:1787" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1787: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1787" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1787: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1787" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1787: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1787" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1787: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y" at_fn_check_prepare_trace "regression.at:1787" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1787" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1787" { set +x printf "%s\n" "$at_srcdir/regression.at:1787: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1787" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1787" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1787" { set +x printf "%s\n" "$at_srcdir/regression.at:1787: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1787" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1788: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "regression.at:1788" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/regression.at:1788" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1788: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1788" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reading a token Next token is token \"invalid token\" () LAC: initial context established for \"invalid token\" LAC: checking lookahead \"invalid token\": Always Err Constructing syntax error message LAC: checking lookahead \"end of file\": R2 G3 R2 G5 R2 G6 R2 G7 R2 G8 R2 G9 R2 G10 R2 G11 R2 (max size exceeded) syntax error memory exhausted Cleanup: discarding lookahead token \"invalid token\" () Stack now 0 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1788" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_652 #AT_START_653 at_fn_group_banner 653 'regression.at:1874' \ "Lex and parse params: yacc.c" " " 25 at_xfail=no ( printf "%s\n" "653. $at_setup_line: testing $at_desc ..." $at_traceon ## FIXME: Improve parsing of parse-param. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %header %locations %skeleton "yacc.c" %union { int ival; } %parse-param { int x } // Spaces, tabs, and new lines. %parse-param { int y } %{ #include /* printf. */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (int x, int y, const char *msg); static int yylex (void); %} %% exp: 'a' { printf ("x: %d, y: %d\n", x, y); }; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (int x, int y, const char *msg) { YY_USE (x); YY_USE (y); LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } int main (void) { return yyparse(1, 2); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1874: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1874" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1874: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1874" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1874: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1874" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1874: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1874" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1874: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1874" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1874: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1874" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1874" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1874" { set +x printf "%s\n" "$at_srcdir/regression.at:1874: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1874" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1874: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1874" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "x: 1, y: 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1874: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1874" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1874" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_653 #AT_START_654 at_fn_group_banner 654 'regression.at:1875' \ "Lex and parse params: glr.c" " " 25 at_xfail=no ( printf "%s\n" "654. $at_setup_line: testing $at_desc ..." $at_traceon ## FIXME: Improve parsing of parse-param. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %header %locations %skeleton "glr.c" %union { int ival; } %parse-param { int x } // Spaces, tabs, and new lines. %parse-param { int y } %{ #include /* printf. */ #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (int x, int y, const char *msg); static int yylex (void); %} %% exp: 'a' { printf ("x: %d, y: %d\n", x, y); }; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (int x, int y, const char *msg) { YY_USE (x); YY_USE (y); LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } int main (void) { return yyparse(1, 2); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1875: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1875" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1875: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1875" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1875: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1875" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1875: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1875" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1875: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1875" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1875: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1875" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1875" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1875" { set +x printf "%s\n" "$at_srcdir/regression.at:1875: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1875" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1875: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1875" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "x: 1, y: 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1875: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1875" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1875" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_654 #AT_START_655 at_fn_group_banner 655 'regression.at:1876' \ "Lex and parse params: lalr1.cc" " " 25 at_xfail=no ( printf "%s\n" "655. $at_setup_line: testing $at_desc ..." $at_traceon ## FIXME: Improve parsing of parse-param. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %header %locations %skeleton "lalr1.cc" %union { int ival; } %parse-param { int x } // Spaces, tabs, and new lines. %parse-param { int y } %{ #include /* printf. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); %} %% exp: 'a' { printf ("x: %d, y: %d\n", x, y); }; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int yyparse (int x, int y) { yy::parser parser(x, y); return parser.parse (); } int main (void) { return yyparse(1, 2); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1876: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1876" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1876: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "regression.at:1876" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1876: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1876" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1876: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1876" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1876: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1876" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1876: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "regression.at:1876" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1876" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1876" { set +x printf "%s\n" "$at_srcdir/regression.at:1876: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "regression.at:1876" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1876: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1876" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "x: 1, y: 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1876: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1876" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1876" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_655 #AT_START_656 at_fn_group_banner 656 'regression.at:1877' \ "Lex and parse params: glr.cc" " " 25 at_xfail=no ( printf "%s\n" "656. $at_setup_line: testing $at_desc ..." $at_traceon ## FIXME: Improve parsing of parse-param. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %header %locations %skeleton "glr.cc" %union { int ival; } %parse-param { int x } // Spaces, tabs, and new lines. %parse-param { int y } %{ #include /* printf. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); %} %% exp: 'a' { printf ("x: %d, y: %d\n", x, y); }; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int yyparse (int x, int y) { yy::parser parser(x, y); return parser.parse (); } int main (void) { return yyparse(1, 2); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "regression.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1877: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1877" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1877: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1877" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1877: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1877" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1877: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "regression.at:1877" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1877" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1877" { set +x printf "%s\n" "$at_srcdir/regression.at:1877: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "regression.at:1877" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1877: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1877" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "x: 1, y: 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1877: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1877" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1877" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_656 #AT_START_657 at_fn_group_banner 657 'regression.at:1878' \ "Lex and parse params: glr2.cc" " " 25 at_xfail=no ( printf "%s\n" "657. $at_setup_line: testing $at_desc ..." $at_traceon ## FIXME: Improve parsing of parse-param. cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %header %locations %skeleton "glr2.cc" %union { int ival; } %parse-param { int x } // Spaces, tabs, and new lines. %parse-param { int y } %{ #include /* printf. */ static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); %} %% exp: 'a' { printf ("x: %d, y: %d\n", x, y); }; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int yyparse (int x, int y) { yy::parser parser(x, y); return parser.parse (); } int main (void) { return yyparse(1, 2); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1878: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1878" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1878: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "regression.at:1878" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1878: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1878" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1878: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1878" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1878: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1878" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1878: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "regression.at:1878" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1878" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1878" printf "%s\n" "regression.at:1878" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1878" { set +x printf "%s\n" "$at_srcdir/regression.at:1878: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "regression.at:1878" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1878: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "regression.at:1878" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "x: 1, y: 2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1878: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "regression.at:1878" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1878" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_657 #AT_START_658 at_fn_group_banner 658 'regression.at:1889' \ "stdio.h is not needed" " " 25 at_xfail=no ( printf "%s\n" "658. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %locations %code { static int yylex (void) { return 0; } static void yyerror (const char* msg) { (void) msg; } } %% exp: {} %% #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/regression.at:1906: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "regression.at:1906" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/regression.at:1906: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "regression.at:1906" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/regression.at:1906: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1906" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/regression.at:1906: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "regression.at:1906" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/regression.at:1906: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "regression.at:1906" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/regression.at:1906: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "regression.at:1906" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "regression.at:1906" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/regression.at:1906" { set +x printf "%s\n" "$at_srcdir/regression.at:1906: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "regression.at:1906" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/regression.at:1906" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_658 #AT_START_659 at_fn_group_banner 659 'push.at:25' \ "Memory Leak for Early Deletion" " " 26 at_xfail=no ( printf "%s\n" "659. $at_setup_line: testing $at_desc ..." $at_traceon # Requires Valgrind. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #define YYINITDEPTH 1 #include /* !POSIX */ static void yyerror (const char *msg); %} %define api.pure %define api.push-pull push %% start: 'a' 'b' 'c' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int main (void) { yypstate *ps; /* Make sure we don't try to free ps->yyss in this case. */ ps = yypstate_new (); yypstate_delete (ps); /* yypstate_delete used to leak ps->yyss if the stack was reallocated but the parse did not return on success, syntax error, or memory exhaustion. */ ps = yypstate_new (); assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE); yypstate_delete (ps); ps = yypstate_new (); assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE); assert (yypush_parse (ps, 'b', YY_NULLPTR) == YYPUSH_MORE); yypstate_delete (ps); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/push.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "push.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:74" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "push.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:74" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/push.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:74" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/push.at:74: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "push.at:74" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:74" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/push.at:74: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:74" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:74" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/push.at:74: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "push.at:74" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:74" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "push.at:75" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/push.at:75" { set +x printf "%s\n" "$at_srcdir/push.at:75: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "push.at:75" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:75" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:76: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "push.at:76" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:76" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:76: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "push.at:76" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:76" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_659 #AT_START_660 at_fn_group_banner 660 'push.at:84' \ "Multiple impure instances" " " 26 at_xfail=no ( printf "%s\n" "660. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); %} %define api.push-pull both %% start: ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int i; for (i = 0; i < 2; ++i) { yypstate *ps = yypstate_new (); assert (ps); assert (yypstate_new () == YY_NULLPTR); assert (yyparse () == 2); yychar = 0; assert (yypush_parse (ps) == 0); assert (yypstate_new () == YY_NULLPTR); assert (yyparse () == 2); yypstate_delete (ps); } return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/push.at:134: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "push.at:134" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:134: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "push.at:134" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/push.at:134: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:134" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/push.at:134: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "push.at:134" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/push.at:134: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:134" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/push.at:134: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "push.at:134" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "push.at:134" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/push.at:134" { set +x printf "%s\n" "$at_srcdir/push.at:134: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "push.at:134" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:134: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "push.at:134" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:134: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "push.at:134" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:134" $at_failed && at_fn_log_failure $at_traceon; } cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %{ #include #include #include /* !POSIX */ static void yyerror (const char *msg); %} %define api.push-pull push %% start: ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int main (void) { int i; for (i = 0; i < 2; ++i) { yypstate *ps = yypstate_new (); assert (ps); assert (yypstate_new () == YY_NULLPTR); ; yychar = 0; assert (yypush_parse (ps) == 0); assert (yypstate_new () == YY_NULLPTR); ; yypstate_delete (ps); } return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/push.at:135: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "push.at:135" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:135: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "push.at:135" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/push.at:135: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:135" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/push.at:135: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "push.at:135" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/push.at:135: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:135" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/push.at:135: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "push.at:135" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "push.at:135" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/push.at:135" { set +x printf "%s\n" "$at_srcdir/push.at:135: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "push.at:135" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:135: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "push.at:135" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:135: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "push.at:135" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:135" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_660 #AT_START_661 at_fn_group_banner 661 'push.at:145' \ "Unsupported Skeletons" " " 26 at_xfail=no ( printf "%s\n" "661. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %glr-parser %define api.push-pull push %% start: ; _ATEOF { set +x printf "%s\n" "$at_srcdir/push.at:156: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y" "push.at:156" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.y:2.1-26: error: %define variable 'api.push-pull' is not used " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/push.at:156" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_661 #AT_START_662 at_fn_group_banner 662 'push.at:167' \ "Pstate reuse" " " 26 at_xfail=no ( printf "%s\n" "662. $at_setup_line: testing $at_desc ..." $at_traceon # Make sure that when a single pstate is used for multiple successive # parses, no state from a previous run leaks into the following one. # # See https://lists.gnu.org/r/bug-bison/2021-03/msg00000.html. cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code top { #include #include static char *string_concat (char *a, char *b); #include /* !POSIX */ static void yyerror (const char *msg); } %define parse.trace %define api.pure full %define api.push-pull push %expect 0 %union { char *sval; }; %destructor { free ($$); } %printer { fprintf (yyo, "%s", $$); } %token RAW %token EOL %type text %% line : text EOL { printf ("text: %s\n", $1); free ($1); YYACCEPT; }; text : RAW { $$ = $1; } | text RAW { $$ = string_concat ($1, $2); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } static char * string_concat (char *a, char *b) { size_t la = strlen (a); size_t lb = strlen (b); char *res = YY_CAST (char *, malloc (la + lb + 1)); strcpy (res, a); strcpy (res + la, b); free (a); free (b); return res; } static int push (yypstate *ps, yytoken_kind_t kind, const char *str) { YYSTYPE lval; lval.sval = str ? strdup (str) : YY_NULLPTR; switch (yypush_parse (ps, kind, &lval)) { case 0: return 0; case YYPUSH_MORE: // parsing incomplete, but valid; parser not reset return 0; case 1: // YYABORT or syntax invalid; parser is reset fprintf (stderr, "invalid input, but no error was thrown\n"); return 1; case 2: // memory exhaustion; parser is reset fprintf (stderr, "memory exhaustion during yypush_parse\n"); return 1; } return 1; } int main (void) { yydebug = !!getenv ("YYDEBUG"); yypstate *ps = yypstate_new (); #define PUSH(Kind, Val) \ do { \ if (push (ps, Kind, Val)) \ return 1; \ } while (0) PUSH (RAW, "te"); PUSH (RAW, "xt"); PUSH (EOL, YY_NULLPTR); PUSH (RAW, "te"); PUSH (RAW, "xt"); PUSH (EOL, YY_NULLPTR); yypstate_delete (ps); return 0; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/push.at:276: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "push.at:276" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:276: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "push.at:276" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/push.at:276: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:276" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/push.at:276: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "push.at:276" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/push.at:276: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "push.at:276" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/push.at:276: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "push.at:276" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "push.at:276" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/push.at:276" { set +x printf "%s\n" "$at_srcdir/push.at:276: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "push.at:276" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/push.at:276" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/push.at:277: ./input" at_fn_check_prepare_trace "push.at:277" ( $at_check_trace; ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "text: text text: text " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/push.at:277" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_662 #AT_START_663 at_fn_group_banner 663 'c++.at:26' \ "C++ Locations Unit Tests" " " 27 at_xfail=no ( printf "%s\n" "663. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code {#include } %locations %debug %skeleton "lalr1.cc" %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% exp: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } template bool check (const T& in, const std::string& s) { const static bool verbose = getenv ("DEBUG"); std::stringstream os; os << in; if (os.str () == s) { if (verbose) std::cerr << os.str () << '\n'; return true; } else { std::cerr << "fail: " << os.str () << ", expected: " << s << '\n'; return false; } } int main (void) { const std::string fn = "foo.txt"; int fail = 0; yy::parser::location_type loc (&fn); fail += check (loc, "foo.txt:1.1"); fail += check (loc + 10, "foo.txt:1.1-10"); loc += 10; fail += check (loc, "foo.txt:1.1-10"); loc += -5; fail += check (loc, "foo.txt:1.1-5"); fail += check (loc - 5, "foo.txt:1.1"); loc -= 5; fail += check (loc, "foo.txt:1.1"); // Check that we don't go below. // https://lists.gnu.org/r/bug-bison/2013-02/msg00000.html loc -= 10; fail += check (loc, "foo.txt:1.1"); loc.columns (10); loc.lines (10); fail += check (loc, "foo.txt:1.1-11.0"); loc.lines (-2); fail += check (loc, "foo.txt:1.1-9.0"); loc.lines (-10); fail += check (loc, "foo.txt:1.1"); yy::parser::location_type loc2 (YY_NULLPTR, 5, 10); fail += check (loc2, "5.10"); fail += check (loc + loc2, "foo.txt:1.1-5.9"); loc += loc2; fail += check (loc, "foo.txt:1.1-5.9"); return !fail; } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:92: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:92" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:92: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "c++.at:92" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:92: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:92" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:92: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:92" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:92: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:92" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:92: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "c++.at:92" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:92" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:92" { set +x printf "%s\n" "$at_srcdir/c++.at:92: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:92" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:92: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:92" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:92: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:92" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:92" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_663 #AT_START_664 at_fn_group_banner 664 'c++.at:107' \ "C++ Variant-based Symbols Unit Tests" " " 27 at_xfail=no ( printf "%s\n" "664. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.value.type variant %define parse.assert %debug %code provides { static int yylex (yy::parser::value_type *lvalp); } %token INT "int" %type > exp %printer { yyo << $$; } %printer { for (std::vector::const_iterator i = $$.begin (); i != $$.end (); ++i) { if (i != $$.begin ()) yyo << ", "; yyo << *i; } } > %code requires { #include } %code { int yylex (yy::parser::semantic_type* lvalp); } // A hack which relies on internal hooks to check stack_symbol_type, // which is private. %code yy_bison_internal_hook { public: typedef stack_symbol_type yy_stack_symbol_type; typedef stack_type yy_stack_type; } %% exp: "int" { $$.push_back ($1); } %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } template void assert_eq (const Exp& exp, const Eff& eff) { if (getenv ("DEBUG")) std::cerr << "Assert: " << exp << " == " << eff << '\n'; if (exp != eff) std::cerr << "Assertion failed: " << exp << " != " << eff << '\n'; } int main() { using yy::parser; // symbol_type: construction, accessor. { parser::symbol_type s = parser::make_INT (12); assert_eq (s.kind (), parser::symbol_kind::S_INT); assert_eq (parser::symbol_name (s.kind ()), std::string ("\"int\"")); assert_eq (s.name (), std::string ("\"int\"")); assert_eq (s.value.as (), 12); } // symbol_type: move constructor. #if 201103L <= YY_CPLUSPLUS { auto s = parser::make_INT (42); auto s2 = std::move (s); assert_eq (s2.value.as (), 42); // Used to crash here, because s was improperly cleared, and // its destructor tried to delete its (moved) value. } #endif // symbol_type: copy constructor. { parser::symbol_type s = parser::make_INT (51); parser::symbol_type s2 = s; assert_eq (s.value.as (), 51); assert_eq (s2.value.as (), 51); } // stack_symbol_type: construction, accessor. typedef parser::yy_stack_symbol_type stack_symbol_type; { #if 201103L <= YY_CPLUSPLUS auto ss = stack_symbol_type (1, parser::make_INT(123)); #else parser::symbol_type s = parser::make_INT (123); stack_symbol_type ss(1, s); #endif assert_eq (ss.value.as (), 123); } // Pushing on the stack. // Sufficiently many so that it will be resized. // Probably 3 times (starting at 200). { parser::yy_stack_type st; const int mucho = 1700; const int int_reduction_state = 1; // Read list.output to find it. for (int i = 0; i < mucho; ++i) { #if 201103L <= YY_CPLUSPLUS st.push(stack_symbol_type{int_reduction_state, parser::make_INT (i)}); #else parser::symbol_type s = parser::make_INT (i); stack_symbol_type ss (int_reduction_state, s); st.push (ss); #endif } for (int i = mucho - 1; 0 <= i; --i) { assert_eq (st[0].value.as(), i); st.pop (); } } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:234: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:234" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:234" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:234: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.yy" "c++.at:234" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:234" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:234: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:234" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:234" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:234: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:234" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:234" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:234: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:234" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:234" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:234: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.yy" at_fn_check_prepare_trace "c++.at:234" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:234" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:235" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:235" { set +x printf "%s\n" "$at_srcdir/c++.at:235: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:235" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:235" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:235: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:235" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:235" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:235: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:235" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:235" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_664 #AT_START_665 at_fn_group_banner 665 'c++.at:247' \ "Multiple occurrences of \$n and api.value.automove" "" 27 at_xfail=no ( printf "%s\n" "665. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.value.automove %token NUMBER "number" %type exp %% exp: "number" { $$ = $1; $$; } | "twice" exp { $$ = $2 + $2; } | "thrice" exp[val] { $$ = $2 + $val + $2; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.yy" "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:263: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:263" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:263: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:263" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:263: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:263" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.yy" at_fn_check_prepare_trace "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "input.yy:16.33-34: warning: multiple occurrences of \$2 with api.value.automove [-Wother] 16 | | \"twice\" exp { \$\$ = \$2 + \$2; } | ^~ input.yy:17.33-36: warning: multiple occurrences of \$2 with api.value.automove [-Wother] 17 | | \"thrice\" exp[val] { \$\$ = \$2 + \$val + \$2; } | ^~~~ input.yy:17.40-41: warning: multiple occurrences of \$2 with api.value.automove [-Wother] 17 | | \"thrice\" exp[val] { \$\$ = \$2 + \$val + \$2; } | ^~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } # Defining POSIXLY_CORRECT causes bison to complain if options are # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then at_save_special_files # To avoid expanding it repeatedly, store specified stdout. : >expout # Run with -Werror. { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy -Werror" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy -Werror" "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy -Werror ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } if test x"$PERL" != x; then # Build expected stderr up to and including the "warnings being # treated as errors" message. cat >experr <<'_ATEOF' input.yy:16.33-34: warning: multiple occurrences of $2 with api.value.automove [-Wother] 16 | | "twice" exp { $$ = $2 + $2; } | ^~ input.yy:17.33-36: warning: multiple occurrences of $2 with api.value.automove [-Wother] 17 | | "thrice" exp[val] { $$ = $2 + $val + $2; } | ^~~~ input.yy:17.40-41: warning: multiple occurrences of $2 with api.value.automove [-Wother] 17 | | "thrice" exp[val] { $$ = $2 + $val + $2; } | ^~ _ATEOF "$PERL" -pi -e 's{(.*): warning:}{$1: error:};' \ -e 's{\[-W(.*)\]$}{[-Werror=$1]}' \ experr { set +x printf "%s\n" "$at_srcdir/c++.at:263: sed 's,.*/\$,,' stderr 1>&2" at_fn_check_prepare_dynamic "sed 's,.*/$,,' stderr 1>&2" "c++.at:263" ( $at_check_trace; sed 's,.*/$,,' stderr 1>&2 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } # Now check --warnings=error. cp stderr experr { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy --warnings=error" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy --warnings=error" "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy --warnings=error ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter $at_diff experr "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } fi # Now check -Wnone and --warnings=none by making sure that # -Werror doesn't change the exit status when -Wnone or # --warnings=none is specified. With traces disabled, there should # be no output on stderr. { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy -Wnone,none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy -Wnone,none -Werror --trace=none" "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy -Wnone,none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:263: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy --warnings=none -Werror --trace=none" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy --warnings=none -Werror --trace=none" "c++.at:263" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret input.yy --warnings=none -Werror --trace=none ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:263" $at_failed && at_fn_log_failure $at_traceon; } at_restore_special_files fi set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_665 #AT_START_666 at_fn_group_banner 666 'c++.at:566' \ "Variants lalr1.cc" " " 27 at_xfail=no ( printf "%s\n" "666. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static int yylex (yy::parser::value_type *lvalp); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #ifdef TWO_STAGE_BUILD # define BUILD(Type, Value) build () = Value #else # define BUILD(Type, Value) build (Value) #endif #define STAGE_MAX 5 namespace yy { static int yylex (yy::parser::value_type *lvalp) { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return yy::parser::token::END_OF_FILE; case ',': return yy::parser::token::COMMA; default: stage = stage - '0'; if (stage % 2) { lvalp->BUILD (int, stage); return yy::parser::token::NUMBER; } else { lvalp->BUILD (string, to_string (stage)); return yy::parser::token::TEXT; } } } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:566: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:566" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:566: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:566" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:566" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:566: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:566" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:566" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:566: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:566" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:566" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:566" { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:566" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:566" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:566" { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:566" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:566" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:566" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:566: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:566" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:566: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:566" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:566: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:566" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:566" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_666 #AT_START_667 at_fn_group_banner 667 'c++.at:567' \ "Variants lalr1.cc parse.assert" " " 27 at_xfail=no ( printf "%s\n" "667. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static int yylex (yy::parser::value_type *lvalp); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #ifdef TWO_STAGE_BUILD # define BUILD(Type, Value) build () = Value #else # define BUILD(Type, Value) build (Value) #endif #define STAGE_MAX 5 namespace yy { static int yylex (yy::parser::value_type *lvalp) { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return yy::parser::token::END_OF_FILE; case ',': return yy::parser::token::COMMA; default: stage = stage - '0'; if (stage % 2) { lvalp->BUILD (int, stage); return yy::parser::token::NUMBER; } else { lvalp->BUILD (string, to_string (stage)); return yy::parser::token::TEXT; } } } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:567: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:567" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:567: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:567" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:567" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:567: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:567" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:567" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:567: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:567" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:567" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:567" { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:567" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:567" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:567" { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:567" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:567" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:567" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:567: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:567" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:567: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:567" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:567: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:567" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:567" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_667 #AT_START_668 at_fn_group_banner 668 'c++.at:568' \ "Variants lalr1.cc parse.assert api.value.automove" "" 27 at_xfail=no ( printf "%s\n" "668. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %define api.value.automove %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static int yylex (yy::parser::value_type *lvalp); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #ifdef TWO_STAGE_BUILD # define BUILD(Type, Value) build () = Value #else # define BUILD(Type, Value) build (Value) #endif #define STAGE_MAX 5 namespace yy { static int yylex (yy::parser::value_type *lvalp) { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return yy::parser::token::END_OF_FILE; case ',': return yy::parser::token::COMMA; default: stage = stage - '0'; if (stage % 2) { lvalp->BUILD (int, stage); return yy::parser::token::NUMBER; } else { lvalp->BUILD (string, to_string (stage)); return yy::parser::token::TEXT; } } } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:568: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:568" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:568: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:568" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:568" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:568: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:568" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:568" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:568: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:568" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:568" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:568" { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:568" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:568" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:568" { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:568" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:568" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if $modern; then { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:568" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:568: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:568" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:568: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:568" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:568: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:568" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:568" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_668 #AT_START_669 at_fn_group_banner 669 'c++.at:569' \ "Variants lalr1.cc parse.assert %locations" " " 27 at_xfail=no ( printf "%s\n" "669. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %locations %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #ifdef TWO_STAGE_BUILD # define BUILD(Type, Value) build () = Value #else # define BUILD(Type, Value) build (Value) #endif #define STAGE_MAX 5 namespace yy { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: *llocp = location (); return yy::parser::token::END_OF_FILE; case ',': *llocp = location (); return yy::parser::token::COMMA; default: stage = stage - '0'; if (stage % 2) { lvalp->BUILD (int, stage); *llocp = location (); return yy::parser::token::NUMBER; } else { lvalp->BUILD (string, to_string (stage)); *llocp = location (); return yy::parser::token::TEXT; } } } } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:569: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:569" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:569: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:569" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:569" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:569: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:569" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:569" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:569: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:569" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:569" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:569" { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:569" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:569" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:569" { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:569" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:569" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:569" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:569: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:569" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:569: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:569" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:569: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:569" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:569" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_669 #AT_START_670 at_fn_group_banner 670 'c++.at:570' \ "Variants lalr1.cc parse.assert %code {\\n#define TWO_STAGE_BUILD\\n}" "" 27 at_xfail=no ( printf "%s\n" "670. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %code { #define TWO_STAGE_BUILD } %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static int yylex (yy::parser::value_type *lvalp); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #ifdef TWO_STAGE_BUILD # define BUILD(Type, Value) build () = Value #else # define BUILD(Type, Value) build (Value) #endif #define STAGE_MAX 5 namespace yy { static int yylex (yy::parser::value_type *lvalp) { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return yy::parser::token::END_OF_FILE; case ',': return yy::parser::token::COMMA; default: stage = stage - '0'; if (stage % 2) { lvalp->BUILD (int, stage); return yy::parser::token::NUMBER; } else { lvalp->BUILD (string, to_string (stage)); return yy::parser::token::TEXT; } } } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:570: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:570" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:570: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:570" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:570" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:570: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:570" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:570" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:570: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:570" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:570" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:570" { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:570" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:570" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:570" { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:570" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:570" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:570" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:570: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:570" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:570: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:570" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:570: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:570" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:570" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_670 #AT_START_671 at_fn_group_banner 671 'c++.at:571' \ "Variants lalr1.cc parse.assert api.token.constructor" "" 27 at_xfail=no ( printf "%s\n" "671. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static yy::parser::symbol_type yylex (); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #define STAGE_MAX 5 namespace yy { static yy::parser::symbol_type yylex () { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return parser::make_END_OF_FILE (); case ',': return parser::make_COMMA (); default: stage = stage - '0'; if (stage % 2) { return parser::make_NUMBER (stage); } else { return parser::make_TEXT (to_string (stage)); } } } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:571: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:571" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:571: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:571" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:571" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:571: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:571" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:571" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:571: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:571" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:571" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:571" { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:571" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:571" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:571" { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:571" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:571" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:571" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:571: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:571" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:571: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:571" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:571: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:571" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:571" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_671 #AT_START_672 at_fn_group_banner 672 'c++.at:572' \ "Variants lalr1.cc parse.assert api.token.constructor api.token.prefix={TOK_}" "" 27 at_xfail=no ( printf "%s\n" "672. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_} %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static yy::parser::symbol_type yylex (); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #define STAGE_MAX 5 namespace yy { static yy::parser::symbol_type yylex () { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return parser::make_END_OF_FILE (); case ',': return parser::make_COMMA (); default: stage = stage - '0'; if (stage % 2) { return parser::make_NUMBER (stage); } else { return parser::make_TEXT (to_string (stage)); } } } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:572: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:572" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:572: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:572" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:572" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:572: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:572" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:572" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:572: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:572" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:572" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:572" { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:572" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:572" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:572" { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:572" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:572" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:572" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:572: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:572" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:572: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:572" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:572: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:572" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:572" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_672 #AT_START_673 at_fn_group_banner 673 'c++.at:573' \ "Variants lalr1.cc parse.assert api.token.constructor api.token.prefix={TOK_} %locations" "" 27 at_xfail=no ( printf "%s\n" "673. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_} %locations %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static yy::parser::symbol_type yylex (); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #define STAGE_MAX 5 namespace yy { static yy::parser::symbol_type yylex () { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return parser::make_END_OF_FILE (location ()); case ',': return parser::make_COMMA (location ()); default: stage = stage - '0'; if (stage % 2) { return parser::make_NUMBER (stage, location ()); } else { return parser::make_TEXT (to_string (stage), location ()); } } } } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:573: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:573" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:573: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:573" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:573" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:573: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:573" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:573" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:573: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:573" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:573" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:573" { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:573" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:573" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:573" { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:573" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:573" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if false; then { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:573" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:573: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:573" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:573: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:573" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:573: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:573" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:573" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_673 #AT_START_674 at_fn_group_banner 674 'c++.at:574' \ "Variants lalr1.cc parse.assert api.token.constructor api.token.prefix={TOK_} %locations api.value.automove" "" 27 at_xfail=no ( printf "%s\n" "674. $at_setup_line: testing $at_desc ..." $at_traceon # Store strings and integers in a vector of strings. cat >list.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %debug %define api.value.type variant %skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_} %locations %define api.value.automove %code top // code for the .cc file. { #include // abort, getenv #include #include #include #include class string { public: string () {} string (const std::string& s) : val_(s) {} string (const string& s) : val_(s.val_) {} string& operator= (const string& s) { val_ = s.val_; return *this; } #if defined __cplusplus && 201103L <= __cplusplus string (string&& s) noexcept : val_(std::move(s.val_)) { s.val_.clear(); } string& operator= (string&& s) { val_ = std::move(s.val_); s.val_.clear (); return *this; } #endif friend std::ostream& operator<< (std::ostream& o, const string& s) { return o << s.val_; } private: std::string val_; }; typedef std::vector strings_type; namespace yy { // Must be available early, as is used in %destructor. std::ostream& operator<<(std::ostream& o, const strings_type& s) { o << '('; for (strings_type::const_iterator i = s.begin (); i != s.end (); ++i) { if (i != s.begin ()) o << ", "; o << *i; } return o << ')'; } } } %code // code for the .cc file. { namespace yy { static yy::parser::symbol_type yylex (); // Conversion to string. template inline string to_string (const T& t) { std::ostringstream o; o << t; return string (o.str ()); } } } %token <::string> TEXT; %token NUMBER; %token END_OF_FILE 0; %token COMMA "," // Starting with :: to ensure we don't output "<::" which starts by the // digraph for the left square bracket. %type <::string> item; // Using the template type to exercise its parsing. %type <::std::vector> list; %printer { yyo << $$; } <::string> <::std::vector>; %destructor { std::cerr << "Destroy: " << $$ << '\n'; } <*>; %destructor { std::cerr << "Destroy: \"" << $$ << "\"\n"; } <::string>; %% result: list { std::cout << $1 << '\n'; } ; list: item { $$.push_back ($1); } | list "," item { $$ = $1; $$.push_back ($3); } | list error { $$ = $1; } ; item: TEXT { $$ = $1; } | NUMBER { int v = $1; if (v == 3) YYERROR; else $$ = to_string (v); } ; %% #define STAGE_MAX 5 namespace yy { static yy::parser::symbol_type yylex () { // The 5 is a syntax error whose recovery requires that we discard // the lookahead. This tests a regression, see // . static char const *input = "0,1,2,3,45,6"; switch (int stage = *input++) { case 0: return parser::make_END_OF_FILE (location ()); case ',': return parser::make_COMMA (location ()); default: stage = stage - '0'; if (stage % 2) { return parser::make_NUMBER (stage, location ()); } else { return parser::make_TEXT (to_string (stage), location ()); } } } } /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF cat >modern.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include int main() { #if defined __cplusplus && 201103L <= __cplusplus std::cout << "Modern C++: " << __cplusplus << '\n'; return 0; #else std::cout << "Legac++\n"; return 1; #endif } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:574: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o list.cc list.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:574" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:574: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y" "c++.at:574" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:574" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:574: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:574" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:574" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:574: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y" at_fn_check_prepare_trace "c++.at:574" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o list.cc list.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:574" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:574" { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o list list.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS" "c++.at:574" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o list list.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } # Are we compiling with modern C++ enabled? printf "%s\n" "c++.at:574" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:574" { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o modern modern.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS" "c++.at:574" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o modern modern.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } here=. # Pacify cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$here/modern" at_fn_check_prepare_dynamic "$here/modern" "c++.at:574" ( $at_check_trace; $here/modern ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_skip $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status = 0; then modern=true else modern=false fi if $modern; then { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:574" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:574: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:574" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"\" Destroy: \"\" Destroy: 1 Destroy: \"\" Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: \"\" Destroy: 3 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: () Destroy: 5 Destroy: () Destroy: \"\" Destroy: \"\" Destroy: () Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } else { set +x printf "%s\n" "$at_srcdir/c++.at:574: \$PREPARSER ./list" at_fn_check_prepare_dynamic " $PREPARSER ./list" "c++.at:574" ( $at_check_trace; $PREPARSER ./list ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "(0, 1, 2, 4, 6) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:574: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:574" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Destroy: \"0\" Destroy: \"0\" Destroy: 1 Destroy: \"1\" Destroy: (0) Destroy: \"2\" Destroy: \"2\" Destroy: (0, 1) Destroy: \"\" Destroy: 3 Destroy: (0, 1, 2) Destroy: \"4\" Destroy: \"4\" Destroy: (0, 1, 2) Destroy: (0, 1, 2, 4) Destroy: 5 Destroy: (0, 1, 2, 4) Destroy: \"6\" Destroy: \"6\" Destroy: (0, 1, 2, 4) Destroy: (0, 1, 2, 4, 6) " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:574" $at_failed && at_fn_log_failure $at_traceon; } fi done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_674 #AT_START_675 at_fn_group_banner 675 'c++.at:584' \ "Variants and Typed Midrule Actions" " " 27 at_xfail=no ( printf "%s\n" "675. $at_setup_line: testing $at_desc ..." $at_traceon # See https://lists.gnu.org/r/bug-bison/2017-06/msg00000.html. # # Check that typed midrule actions behave properly (pre-construction # of $$ before the user action, support of %printer and %destructor, # etc.). cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %header %debug %define parse.assert %define api.value.type variant %define api.token.constructor %define parse.error verbose %code { #include namespace yy { static yy::parser::symbol_type yylex(); } } %token NUMBER; %type expr; %token EOI 0; %printer { yyo << $$; } ; %destructor { std::cerr << "destroy: " << $$ << '\n'; } %% expr: NUMBER { $$ = $1 * 10; } | expr { $$ = 20; } NUMBER { std::cerr << "expr: " << $1 << ' ' << $2 << ' ' << $3 << '\n'; $$ = 40; } ; %% namespace yy { parser::symbol_type yylex() { static int loc = 0; switch (loc++) { case 0: return parser::make_NUMBER (1); case 1: return parser::make_NUMBER (30); default: return parser::make_EOI (); } } void parser::error(const std::string& message) { std::cerr << message << '\n'; } } int main() { yy::parser p; p.set_debug_level (1); return p.parse(); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:659: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:659" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:659: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "c++.at:659" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:659: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:659" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:659: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:659" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:659: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:659" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:659: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "c++.at:659" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:659" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:659" { set +x printf "%s\n" "$at_srcdir/c++.at:659: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:659" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } # This used to print "Discarding 'a'." again at the end. { set +x printf "%s\n" "$at_srcdir/c++.at:659: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:659" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:659: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:659" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Stack now 0 Reading a token Next token is token NUMBER (1) Shifting token NUMBER (1) Entering state 1 Stack now 0 1 Reducing stack by rule 1 (line 34): \$1 = token NUMBER (1) -> \$\$ = nterm expr (10) destroy: 1 Entering state 2 Stack now 0 2 Reading a token Next token is token NUMBER (30) Reducing stack by rule 2 (line 35): -> \$\$ = nterm @1 (20) Entering state 4 Stack now 0 2 4 Next token is token NUMBER (30) Shifting token NUMBER (30) Entering state 5 Stack now 0 2 4 5 Reducing stack by rule 3 (line 35): \$1 = nterm expr (10) \$2 = nterm @1 (20) \$3 = token NUMBER (30) expr: 10 20 30 -> \$\$ = nterm expr (40) destroy: 30 destroy: 20 destroy: 10 Entering state 2 Stack now 0 2 Reading a token Next token is token EOI () Shifting token EOI () Entering state 3 Stack now 0 2 3 Stack now 0 2 3 Cleanup: popping token EOI () Cleanup: popping nterm expr (40) destroy: 40 " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:659" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_675 #AT_START_676 at_fn_group_banner 676 'c++.at:794' \ "Doxygen Public Documentation" " " 27 at_xfail=no ( printf "%s\n" "676. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %require "3.2" %skeleton "lalr1.cc" %locations %header %debug %% exp: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:794: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:794" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:794: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:794" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:794: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:794" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:794: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:794" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:794: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:794" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:794: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:794" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } cat >Doxyfile <<'_ATEOF' # The PROJECT_NAME tag is a single word (or a sequence of words # surrounded by quotes) that should identify the project. PROJECT_NAME = "Bison C++ Parser" # The QUIET tag can be used to turn on/off the messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages # that are generated by doxygen. Possible values are YES and NO. If # left blank NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then # this flag will automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings # for potential errors in the documentation, such as not documenting # some parameters in a documented function, or documenting parameters # that don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages # that doxygen can produce. The string should contain the $file, # $line, and $text tags, which will be replaced by the file and line # number from which the warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # If the EXTRACT_ALL tag is set to YES doxygen will assume all # entities in documentation are documented, even if no documentation # was available. Private class members and static file members will # be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set # to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a # class will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO _ATEOF { set +x printf "%s\n" "$at_srcdir/c++.at:794: doxygen --version || exit 77" at_fn_check_prepare_trace "c++.at:794" ( $at_check_trace; doxygen --version || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:794: doxygen" at_fn_check_prepare_trace "c++.at:794" ( $at_check_trace; doxygen ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:794" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_676 #AT_START_677 at_fn_group_banner 677 'c++.at:795' \ "Doxygen Private Documentation" " " 27 at_xfail=no ( printf "%s\n" "677. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %require "3.2" %skeleton "lalr1.cc" %locations %header %debug %% exp: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:795: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:795" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:795: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:795" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:795: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:795" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:795: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:795" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:795: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:795" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:795: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:795" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } cat >Doxyfile <<'_ATEOF' # The PROJECT_NAME tag is a single word (or a sequence of words # surrounded by quotes) that should identify the project. PROJECT_NAME = "Bison C++ Parser" # The QUIET tag can be used to turn on/off the messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages # that are generated by doxygen. Possible values are YES and NO. If # left blank NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then # this flag will automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings # for potential errors in the documentation, such as not documenting # some parameters in a documented function, or documenting parameters # that don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages # that doxygen can produce. The string should contain the $file, # $line, and $text tags, which will be replaced by the file and line # number from which the warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # If the EXTRACT_ALL tag is set to YES doxygen will assume all # entities in documentation are documented, even if no documentation # was available. Private class members and static file members will # be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set # to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a # class will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES _ATEOF { set +x printf "%s\n" "$at_srcdir/c++.at:795: doxygen --version || exit 77" at_fn_check_prepare_trace "c++.at:795" ( $at_check_trace; doxygen --version || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:795: doxygen" at_fn_check_prepare_trace "c++.at:795" ( $at_check_trace; doxygen ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:795" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_677 #AT_START_678 at_fn_group_banner 678 'c++.at:848' \ "Relative namespace references" " " 27 at_xfail=no ( printf "%s\n" "678. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo} %union { int i; } %locations %code { int yylex (foo::parser::semantic_type *lval, const foo::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo::parser::error (const foo::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:849: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:849" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:849: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:849" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:849: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:849" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:849: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:849" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:849: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:849" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:849: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:849" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:849" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:849" { set +x printf "%s\n" "$at_srcdir/c++.at:849: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:849" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:849: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:849" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:849: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:849" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:849" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo::bar} %union { int i; } %locations %code { int yylex (foo::bar::parser::semantic_type *lval, const foo::bar::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo::bar::parser::error (const foo::bar::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo::bar::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:850: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:850" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:850: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:850" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:850: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:850" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:850: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:850" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:850: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:850" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:850: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:850" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:850" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:850" { set +x printf "%s\n" "$at_srcdir/c++.at:850: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:850" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:850: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:850" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:850: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:850" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:850" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo::bar::baz} %union { int i; } %locations %code { int yylex (foo::bar::baz::parser::semantic_type *lval, const foo::bar::baz::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo::bar::baz::parser::error (const foo::bar::baz::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo::bar::baz::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:851: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:851" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:851: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:851" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:851: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:851" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:851: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:851" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:851: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:851" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:851: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:851" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:851" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:851" { set +x printf "%s\n" "$at_srcdir/c++.at:851: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:851" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:851: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:851" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:851: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:851" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:851" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_678 #AT_START_679 at_fn_group_banner 679 'c++.at:854' \ "Absolute namespace references" " " 27 at_xfail=no ( printf "%s\n" "679. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {::foo} %union { int i; } %locations %code { int yylex (::foo::parser::semantic_type *lval, const ::foo::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void ::foo::parser::error (const ::foo::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { ::foo::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:855: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:855" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:855: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:855" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:855: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:855" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:855: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:855" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:855: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:855" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:855: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:855" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:855" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:855" { set +x printf "%s\n" "$at_srcdir/c++.at:855: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:855" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:855: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:855" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:855: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:855" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:855" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {::foo::bar} %union { int i; } %locations %code { int yylex (::foo::bar::parser::semantic_type *lval, const ::foo::bar::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void ::foo::bar::parser::error (const ::foo::bar::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { ::foo::bar::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:856: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:856" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:856: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:856" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:856: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:856" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:856" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:856" { set +x printf "%s\n" "$at_srcdir/c++.at:856: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:856" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:856: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:856" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:856: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:856" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:856" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {::foo::bar::baz} %union { int i; } %locations %code { int yylex (::foo::bar::baz::parser::semantic_type *lval, const ::foo::bar::baz::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void ::foo::bar::baz::parser::error (const ::foo::bar::baz::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { ::foo::bar::baz::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:857: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:857" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:857: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:857" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:857: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:857" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:857: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:857" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:857: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:857" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:857: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:857" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:857" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:857" { set +x printf "%s\n" "$at_srcdir/c++.at:857: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:857" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:857: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:857" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:857: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:857" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:857" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace { ::foo} %union { int i; } %locations %code { int yylex ( ::foo::parser::semantic_type *lval, const ::foo::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void ::foo::parser::error (const ::foo::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { ::foo::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:858: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:858" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:858: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:858" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:858: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:858" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:858: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:858" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:858: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:858" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:858: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:858" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:858" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:858" { set +x printf "%s\n" "$at_srcdir/c++.at:858: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:858" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:858: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:858" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:858: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:858" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:858" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace { ::foo::bar} %union { int i; } %locations %code { int yylex ( ::foo::bar::parser::semantic_type *lval, const ::foo::bar::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void ::foo::bar::parser::error (const ::foo::bar::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { ::foo::bar::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:859: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:859" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:859: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:859" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:859: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:859" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:859: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:859" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:859" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:859" { set +x printf "%s\n" "$at_srcdir/c++.at:859: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:859" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:859: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:859" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:859: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:859" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:859" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace { ::foo::bar::baz} %union { int i; } %locations %code { int yylex ( ::foo::bar::baz::parser::semantic_type *lval, const ::foo::bar::baz::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void ::foo::bar::baz::parser::error (const ::foo::bar::baz::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { ::foo::bar::baz::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:860: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:860" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:860: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:860" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:860: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:860" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:860: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:860" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:860: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:860" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:860: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:860" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:860" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:860" { set +x printf "%s\n" "$at_srcdir/c++.at:860: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:860" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:860: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:860" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:860: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:860" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:860" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_679 #AT_START_680 at_fn_group_banner 680 'c++.at:863' \ "Syntactically invalid namespace references" " " 27 at_xfail=no ( printf "%s\n" "680. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {:foo:bar} %union { int i; } %locations %code { int yylex (:foo:bar::parser::semantic_type *lval, const :foo:bar::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void :foo:bar::parser::error (const :foo:bar::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { :foo:bar::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:864: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:864" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:864" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:864: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:864" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:864" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:864: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:864" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:864" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:864: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:864" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:864" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:864: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:864" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:864" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:864: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:864" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:864" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo: :bar} %union { int i; } %locations %code { int yylex (foo: :bar::parser::semantic_type *lval, const foo: :bar::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo: :bar::parser::error (const foo: :bar::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo: :bar::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:865: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:865" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:865" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:865: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:865" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:865" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:865: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:865" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:865" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:865: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:865" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:865" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:865: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:865" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:865" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:865: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:865" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:865" $at_failed && at_fn_log_failure $at_traceon; } # This one is interesting because '[3]' is encoded as '[3]', which # contains single occurrences of ':'. cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo[3]::bar::baz} %union { int i; } %locations %code { int yylex (foo[3]::bar::baz::parser::semantic_type *lval, const foo[3]::bar::baz::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo[3]::bar::baz::parser::error (const foo[3]::bar::baz::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo[3]::bar::baz::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:868: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:868" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:868" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:868: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:868" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:868" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:868: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:868" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:868" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:868: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:868" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:868" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:868: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:868" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:868" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:868: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:868" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:868" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo::bar,baz} %union { int i; } %locations %code { int yylex (foo::bar,baz::parser::semantic_type *lval, const foo::bar,baz::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo::bar,baz::parser::error (const foo::bar,baz::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo::bar,baz::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:869: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:869" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:869" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:869: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:869" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:869" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:869: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:869" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:869" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:869: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:869" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:869" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:869: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:869" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:869" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:869: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:869" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:869" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %language "C++" %define api.namespace {foo::bar::(baz /* Pacify Emacs ) */} %union { int i; } %locations %code { int yylex (foo::bar::(baz /* Pacify Emacs ) */::parser::semantic_type *lval, const foo::bar::(baz /* Pacify Emacs ) */::parser::location_type*) { lval->i = 3; return 0; } } %% start: ; %% void foo::bar::(baz /* Pacify Emacs ) */::parser::error (const foo::bar::(baz /* Pacify Emacs ) */::parser::location_type &loc, const std::string &msg) { std::cerr << "At " << loc << ": " << msg << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { foo::bar::(baz /* Pacify Emacs ) */::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:870: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:870" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:870" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:870: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:870" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:870" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:870: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:870" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:870" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:870: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:870" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:870" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:870: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:870" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:870" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:870: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:870" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:870" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_680 #AT_START_681 at_fn_group_banner 681 'c++.at:884' \ "Syntax error discarding no lookahead" " " 27 at_xfail=no ( printf "%s\n" "681. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %code { #include int yylex (yy::parser::semantic_type *); #define USE(Args) } %define parse.error verbose %nonassoc 'a' ; %destructor { std::cerr << "Discarding 'a'.\n"; } 'a' %% start: error-reduce consistent-error 'a' { USE ($3); }; error-reduce: 'a' 'a' consistent-error 'a' { USE (($1, $2, $4)); } | 'a' error { std::cerr << "Reducing 'a'.\n"; USE ($1); } ; consistent-error: 'a' | %empty %prec 'a' ; // Provide another context in which all rules are useful so that this // test case looks a little more realistic. start: 'b' consistent-error ; %% int yylex (yy::parser::semantic_type *) { static char const *input = "aa"; return *input++; } void yy::parser::error (const std::string &m) { std::cerr << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:941: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:941" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:941: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "c++.at:941" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:941: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:941" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:941: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:941" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:941: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:941" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:941: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "c++.at:941" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:941" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:941" { set +x printf "%s\n" "$at_srcdir/c++.at:941: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:941" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } # This used to print "Discarding 'a'." again at the end. { set +x printf "%s\n" "$at_srcdir/c++.at:941: \$PREPARSER ./input" at_fn_check_prepare_dynamic " $PREPARSER ./input" "c++.at:941" ( $at_check_trace; $PREPARSER ./input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:941: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:941" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error Discarding 'a'. Reducing 'a'. " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:941" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_681 #AT_START_682 at_fn_group_banner 682 'c++.at:1064' \ "Syntax error as exception: lalr1.cc" " " 27 at_xfail=no ( printf "%s\n" "682. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %header %code { #include int yylex (yy::parser::value_type *); } %define parse.error verbose %define parse.trace %% start: with-recovery | '!' without-recovery; with-recovery: %empty | with-recovery item | with-recovery error { std::cerr << "caught error\n"; } ; without-recovery: %empty | without-recovery item ; item: 'a' | 's' { throw syntax_error ("invalid expression"); } %% void yy::parser::error (const std::string &m) { std::cerr << "error: " << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF # Another file to check syntax_error's linkage. cat >scan.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getchar #include "input.hh" // 'a': valid item, 's': syntax error, 'l': lexical error. int yylex (yy::parser::value_type *lval) { switch (int res = getchar ()) { // Don't choke on echo's \n. case '\n': return yylex (lval); case 'l': throw yy::parser::syntax_error ("invalid character"); default: return res; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1064: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1064" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1064: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:1064" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1064: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1064" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1064: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1064" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1064: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1064" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1064: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:1064" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1064" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1064" { set +x printf "%s\n" "$at_srcdir/c++.at:1064: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc scan.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc scan.cc $LIBS" "c++.at:1064" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc scan.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } # Leave enough valid tokens to make sure we recovered from the # previous error, otherwise we might hide some error messages # (discarded during error recoevery). echo "asaaalaa" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1064: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1064" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1064: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1064" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid expression caught error error: invalid character caught error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } echo "!as" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1064: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1064" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1064: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1064" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid expression " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } echo "!al" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1064: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1064" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1064: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1064" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid character " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1064" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save # AT_FOR_EACH_CXX set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_682 #AT_START_683 at_fn_group_banner 683 'c++.at:1065' \ "Syntax error as exception: glr.cc" " " 27 at_xfail=no ( printf "%s\n" "683. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %header %code { #include int yylex (yy::parser::value_type *); } %define parse.error verbose %define parse.trace %% start: with-recovery | '!' without-recovery; with-recovery: %empty | with-recovery item | with-recovery error { std::cerr << "caught error\n"; } ; without-recovery: %empty | without-recovery item ; item: 'a' | 's' { throw syntax_error ("invalid expression"); } %% void yy::parser::error (const std::string &m) { std::cerr << "error: " << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF # Another file to check syntax_error's linkage. cat >scan.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getchar #include "input.hh" // 'a': valid item, 's': syntax error, 'l': lexical error. int yylex (yy::parser::value_type *lval) { switch (int res = getchar ()) { // Don't choke on echo's \n. case '\n': return yylex (lval); case 'l': throw yy::parser::syntax_error ("invalid character"); default: return res; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1065: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1065" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1065: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:1065" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1065: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1065" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1065: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1065" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1065: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1065" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1065: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:1065" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1065" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1065" { set +x printf "%s\n" "$at_srcdir/c++.at:1065: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc scan.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc scan.cc $LIBS" "c++.at:1065" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc scan.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } # Leave enough valid tokens to make sure we recovered from the # previous error, otherwise we might hide some error messages # (discarded during error recoevery). echo "asaaalaa" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1065: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1065" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1065: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1065" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid expression caught error error: invalid character caught error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } echo "!as" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1065: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1065" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1065: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1065" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid expression " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } echo "!al" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1065: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1065" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1065: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1065" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid character " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1065" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save # AT_FOR_EACH_CXX set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_683 #AT_START_684 at_fn_group_banner 684 'c++.at:1066' \ "Syntax error as exception: glr2.cc" " " 27 at_xfail=no ( printf "%s\n" "684. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr2.cc" %header %code { #include int yylex (yy::parser::value_type *); } %define parse.error verbose %define parse.trace %% start: with-recovery | '!' without-recovery; with-recovery: %empty | with-recovery item | with-recovery error { std::cerr << "caught error\n"; } ; without-recovery: %empty | without-recovery item ; item: 'a' | 's' { throw syntax_error ("invalid expression"); } %% void yy::parser::error (const std::string &m) { std::cerr << "error: " << m << '\n'; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF # Another file to check syntax_error's linkage. cat >scan.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include // getchar #include "input.hh" // 'a': valid item, 's': syntax error, 'l': lexical error. int yylex (yy::parser::value_type *lval) { switch (int res = getchar ()) { // Don't choke on echo's \n. case '\n': return yylex (lval); case 'l': throw yy::parser::syntax_error ("invalid character"); default: return res; } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1066: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1066" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1066: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:1066" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1066" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1066: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1066" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1066" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1066: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:1066" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201103 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "c++.at:1066" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1066" printf "%s\n" "c++.at:1066" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1066" { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "c++.at:1066" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1066: ./check" at_fn_check_prepare_trace "c++.at:1066" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi printf "%s\n" "c++.at:1066" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1066" printf "%s\n" "c++.at:1066" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1066" { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc scan.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc scan.cc $LIBS" "c++.at:1066" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc scan.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } # Leave enough valid tokens to make sure we recovered from the # previous error, otherwise we might hide some error messages # (discarded during error recoevery). echo "asaaalaa" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1066" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1066: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1066" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid expression caught error error: invalid character caught error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } echo "!as" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1066" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1066: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1066" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid expression " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } echo "!al" >in { set +x printf "%s\n" "$at_srcdir/c++.at:1066: \$PREPARSER ./input < in" at_fn_check_prepare_dynamic " $PREPARSER ./input < in" "c++.at:1066" ( $at_check_trace; $PREPARSER ./input < in ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1066: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1066" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "error: invalid character " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1066" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save # AT_FOR_EACH_CXX set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_684 #AT_START_685 at_fn_group_banner 685 'c++.at:1360' \ "Exception safety with error recovery " " " 27 at_xfail=no ( printf "%s\n" "685. $at_setup_line: testing $at_desc ..." $at_traceon cat >exceptions.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include #include void foo () { try { throw std::runtime_error ("foo"); } catch (...) { std::cerr << "Inner caught\n"; throw; } } int main () { try { foo (); } catch (...) { std::cerr << "Outer caught\n"; return 0; } return 1; } _ATEOF printf "%s\n" "c++.at:1360" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1360" { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o exceptions exceptions.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS" "c++.at:1360" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # The "empty" quadrigraph is to protect from cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:1360: ./exceptions || exit 77" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; ./exceptions || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %debug %define parse.error verbose %code requires { #include #include // size_t and getenv. #include #include #include bool debug = false; /// A class that tracks its instances. struct Object { char val; Object () : val ('?') { log (this, "Object::Object"); Object::instances.insert (this); } Object (const Object& that) : val (that.val) { log (this, "Object::Object"); Object::instances.insert (this); } Object (char v) : val (v) { log (this, "Object::Object"); Object::instances.insert (this); } ~Object () { log (this, "Object::~Object"); objects::iterator i = instances.find (this); // Make sure this object is alive. assert (i != instances.end ()); Object::instances.erase (i); } Object& operator= (const Object& that) { val = that.val; return *this; } Object& operator= (char v) { val = v; return *this; } // Static part. typedef std::set objects; static objects instances; static bool empty () { return instances.empty (); } static void log (Object const *o, const std::string& msg) { if (debug) { if (o) std::cerr << o << "->"; std::cerr << msg << " {"; const char* sep = " "; for (objects::const_iterator i = instances.begin(), i_end = instances.end(); i != i_end; ++i) { std::cerr << sep << *i; sep = ", "; } std::cerr << " }\n"; } } }; } %code { #include #include // strchr #include int yylex (yy::parser::semantic_type *); Object::objects Object::instances; static char const *input; } %union { Object *obj; } %destructor { delete $$; } ; %printer { yyo << $$ << " '" << $$->val << '\''; if ($$->val == 'p') throw std::runtime_error ("printer"); } ; %token 'a' 'E' 'e' 'p' 'R' 's' 'T' %type list item %initial-action { if (strchr (input, 'i')) throw std::runtime_error ("initial-action"); } %% start: list { delete $1; }; list: item { $$ = $1; } // Right recursion to load the stack. | item list { $$ = $1; delete $2; } ; item: 'a' { $$ = $1; } | 'e' { YY_USE ($$); YY_USE ($1); error ("syntax error"); } // Not just 'E', otherwise we reduce when 'E' is the lookahead, and // then the stack is emptied, defeating the point of the test. | 'E' 'a' { YY_USE ($1); $$ = $2; } | 'R' { $$ = YY_NULLPTR; delete $1; YYERROR; } | 'p' { $$ = $1; } | 's' { $$ = $1; throw std::runtime_error ("reduction"); } | 'T' { $$ = YY_NULLPTR; delete $1; YYABORT; } | error { $$ = new Object ('R'); yyerrok; } ; %% int yylex (yy::parser::semantic_type *lvalp) { // 'a': no error. // 'e': user action calls error. // 'E': syntax error, with yyerror that throws. // 'i': initial action throws. // 'l': yylex throws. // 'R': call YYERROR in the action // 's': reduction throws. // 'T': call YYABORT in the action switch (char res = *input++) { case 'l': throw std::runtime_error ("yylex"); default: lvalp->obj = new Object (res); goto zero; zero: case 0: return res; } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { throw std::runtime_error (m); } int main (int argc, const char *argv[]) { switch (argc) { case 2: input = argv[1]; break; case 3: assert (std::string(argv[1]) == "--debug"); debug = 1; input = argv[2]; break; default: abort (); } yy::parser parser; debug |= !!getenv ("YYDEBUG"); parser.set_debug_level (debug); int res = 2; try { res = parser.parse (); } catch (const std::exception& e) { std::cerr << "exception caught: " << e.what () << '\n'; } catch (...) { std::cerr << "unknown exception caught\n"; } Object::log (YY_NULLPTR, "end"); assert (Object::empty()); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc --report=all input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" "c++.at:1360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1360" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1360" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1360" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1360" { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:1360" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaas" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaas" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaas ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: reduction " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaal" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaal" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaal ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: yylex " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input i" at_fn_check_prepare_dynamic " $PREPARSER ./input i" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input i ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: initial-action " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaap" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input --debug aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug aaaap" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input --debug aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: grep '^exception caught: printer\$' stderr" at_fn_check_prepare_dynamic "grep '^exception caught: printer$' stderr" "c++.at:1360" ( $at_check_trace; grep '^exception caught: printer$' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaae" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaae" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaae ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaaE" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaE" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaaE ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error, unexpected end of file, expecting 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaaT" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaT" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaaT ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: \$PREPARSER ./input aaaaR" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaR" "c++.at:1360" ( $at_check_trace; $PREPARSER ./input aaaaR ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1360: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1360" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1360" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_685 #AT_START_686 at_fn_group_banner 686 'c++.at:1361' \ "Exception safety without error recovery " " " 27 at_xfail=no ( printf "%s\n" "686. $at_setup_line: testing $at_desc ..." $at_traceon cat >exceptions.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include #include void foo () { try { throw std::runtime_error ("foo"); } catch (...) { std::cerr << "Inner caught\n"; throw; } } int main () { try { foo (); } catch (...) { std::cerr << "Outer caught\n"; return 0; } return 1; } _ATEOF printf "%s\n" "c++.at:1361" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1361" { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o exceptions exceptions.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS" "c++.at:1361" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } # The "empty" quadrigraph is to protect from cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:1361: ./exceptions || exit 77" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; ./exceptions || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %debug %define parse.error verbose %code requires { #include #include // size_t and getenv. #include #include #include bool debug = false; /// A class that tracks its instances. struct Object { char val; Object () : val ('?') { log (this, "Object::Object"); Object::instances.insert (this); } Object (const Object& that) : val (that.val) { log (this, "Object::Object"); Object::instances.insert (this); } Object (char v) : val (v) { log (this, "Object::Object"); Object::instances.insert (this); } ~Object () { log (this, "Object::~Object"); objects::iterator i = instances.find (this); // Make sure this object is alive. assert (i != instances.end ()); Object::instances.erase (i); } Object& operator= (const Object& that) { val = that.val; return *this; } Object& operator= (char v) { val = v; return *this; } // Static part. typedef std::set objects; static objects instances; static bool empty () { return instances.empty (); } static void log (Object const *o, const std::string& msg) { if (debug) { if (o) std::cerr << o << "->"; std::cerr << msg << " {"; const char* sep = " "; for (objects::const_iterator i = instances.begin(), i_end = instances.end(); i != i_end; ++i) { std::cerr << sep << *i; sep = ", "; } std::cerr << " }\n"; } } }; } %code { #include #include // strchr #include int yylex (yy::parser::semantic_type *); Object::objects Object::instances; static char const *input; } %union { Object *obj; } %destructor { delete $$; } ; %printer { yyo << $$ << " '" << $$->val << '\''; if ($$->val == 'p') throw std::runtime_error ("printer"); } ; %token 'a' 'E' 'e' 'p' 'R' 's' 'T' %type list item %initial-action { if (strchr (input, 'i')) throw std::runtime_error ("initial-action"); } %% start: list { delete $1; }; list: item { $$ = $1; } // Right recursion to load the stack. | item list { $$ = $1; delete $2; } ; item: 'a' { $$ = $1; } | 'e' { YY_USE ($$); YY_USE ($1); error ("syntax error"); } // Not just 'E', otherwise we reduce when 'E' is the lookahead, and // then the stack is emptied, defeating the point of the test. | 'E' 'a' { YY_USE ($1); $$ = $2; } | 'R' { $$ = YY_NULLPTR; delete $1; YYERROR; } | 'p' { $$ = $1; } | 's' { $$ = $1; throw std::runtime_error ("reduction"); } | 'T' { $$ = YY_NULLPTR; delete $1; YYABORT; } ; %% int yylex (yy::parser::semantic_type *lvalp) { // 'a': no error. // 'e': user action calls error. // 'E': syntax error, with yyerror that throws. // 'i': initial action throws. // 'l': yylex throws. // 'R': call YYERROR in the action // 's': reduction throws. // 'T': call YYABORT in the action switch (char res = *input++) { case 'l': throw std::runtime_error ("yylex"); default: lvalp->obj = new Object (res); goto zero; zero: case 0: return res; } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { throw std::runtime_error (m); } int main (int argc, const char *argv[]) { switch (argc) { case 2: input = argv[1]; break; case 3: assert (std::string(argv[1]) == "--debug"); debug = 1; input = argv[2]; break; default: abort (); } yy::parser parser; debug |= !!getenv ("YYDEBUG"); parser.set_debug_level (debug); int res = 2; try { res = parser.parse (); } catch (const std::exception& e) { std::cerr << "exception caught: " << e.what () << '\n'; } catch (...) { std::cerr << "unknown exception caught\n"; } Object::log (YY_NULLPTR, "end"); assert (Object::empty()); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1361: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc --report=all input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1361" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" "c++.at:1361" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1361" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1361" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1361: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1361" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1361" { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:1361" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaas" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaas" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaas ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: reduction " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaal" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaal" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaal ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: yylex " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input i" at_fn_check_prepare_dynamic " $PREPARSER ./input i" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input i ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: initial-action " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaap" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input --debug aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug aaaap" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input --debug aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: grep '^exception caught: printer\$' stderr" at_fn_check_prepare_dynamic "grep '^exception caught: printer$' stderr" "c++.at:1361" ( $at_check_trace; grep '^exception caught: printer$' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaae" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaae" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaae ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaaE" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaE" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaaE ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error, unexpected end of file, expecting 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaaT" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaT" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaaT ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: \$PREPARSER ./input aaaaR" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaR" "c++.at:1361" ( $at_check_trace; $PREPARSER ./input aaaaR ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1361: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1361" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1361" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_686 #AT_START_687 at_fn_group_banner 687 'c++.at:1362' \ "Exception safety with error recovery api.value.type=variant" "" 27 at_xfail=no ( printf "%s\n" "687. $at_setup_line: testing $at_desc ..." $at_traceon cat >exceptions.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include #include void foo () { try { throw std::runtime_error ("foo"); } catch (...) { std::cerr << "Inner caught\n"; throw; } } int main () { try { foo (); } catch (...) { std::cerr << "Outer caught\n"; return 0; } return 1; } _ATEOF printf "%s\n" "c++.at:1362" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1362" { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o exceptions exceptions.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS" "c++.at:1362" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # The "empty" quadrigraph is to protect from cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:1362: ./exceptions || exit 77" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; ./exceptions || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %debug %define parse.error verbose %define api.value.type variant %code requires { #include #include // size_t and getenv. #include #include #include bool debug = false; /// A class that tracks its instances. struct Object { char val; Object () : val ('?') { log (this, "Object::Object"); Object::instances.insert (this); } Object (const Object& that) : val (that.val) { log (this, "Object::Object"); Object::instances.insert (this); } Object (char v) : val (v) { log (this, "Object::Object"); Object::instances.insert (this); } ~Object () { log (this, "Object::~Object"); objects::iterator i = instances.find (this); // Make sure this object is alive. assert (i != instances.end ()); Object::instances.erase (i); } Object& operator= (const Object& that) { val = that.val; return *this; } Object& operator= (char v) { val = v; return *this; } // Static part. typedef std::set objects; static objects instances; static bool empty () { return instances.empty (); } static void log (Object const *o, const std::string& msg) { if (debug) { if (o) std::cerr << o << "->"; std::cerr << msg << " {"; const char* sep = " "; for (objects::const_iterator i = instances.begin(), i_end = instances.end(); i != i_end; ++i) { std::cerr << sep << *i; sep = ", "; } std::cerr << " }\n"; } } }; } %code { #include #include // strchr #include int yylex (yy::parser::semantic_type *); Object::objects Object::instances; static char const *input; } %printer { yyo << &$$ << " '" << $$.val << '\''; if ($$.val == 'p') throw std::runtime_error ("printer"); } ; %token 'a' 'E' 'e' 'p' 'R' 's' 'T' %type list item %initial-action { if (strchr (input, 'i')) throw std::runtime_error ("initial-action"); } %% start: list {}; list: item { $$ = $1; } // Right recursion to load the stack. | item list { $$ = $1; } ; item: 'a' { $$ = $1; } | 'e' { YY_USE ($$); YY_USE ($1); error ("syntax error"); } // Not just 'E', otherwise we reduce when 'E' is the lookahead, and // then the stack is emptied, defeating the point of the test. | 'E' 'a' { YY_USE ($1); $$ = $2; } | 'R' { YYERROR; } | 'p' { $$ = $1; } | 's' { $$ = $1; throw std::runtime_error ("reduction"); } | 'T' { YYABORT; } | error { $$ = Object ('R'); yyerrok; } ; %% int yylex (yy::parser::semantic_type *lvalp) { // 'a': no error. // 'e': user action calls error. // 'E': syntax error, with yyerror that throws. // 'i': initial action throws. // 'l': yylex throws. // 'R': call YYERROR in the action // 's': reduction throws. // 'T': call YYABORT in the action switch (char res = *input++) { case 'l': throw std::runtime_error ("yylex"); default: lvalp->build (res); goto zero; zero: case 0: return res; } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { throw std::runtime_error (m); } int main (int argc, const char *argv[]) { switch (argc) { case 2: input = argv[1]; break; case 3: assert (std::string(argv[1]) == "--debug"); debug = 1; input = argv[2]; break; default: abort (); } yy::parser parser; debug |= !!getenv ("YYDEBUG"); parser.set_debug_level (debug); int res = 2; try { res = parser.parse (); } catch (const std::exception& e) { std::cerr << "exception caught: " << e.what () << '\n'; } catch (...) { std::cerr << "unknown exception caught\n"; } Object::log (YY_NULLPTR, "end"); assert (Object::empty()); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1362: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc --report=all input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1362" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" "c++.at:1362" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1362" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1362" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1362: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1362" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1362" { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:1362" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaas" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaas" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaas ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: reduction " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaal" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaal" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaal ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: yylex " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input i" at_fn_check_prepare_dynamic " $PREPARSER ./input i" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input i ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: initial-action " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaap" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input --debug aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug aaaap" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input --debug aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: grep '^exception caught: printer\$' stderr" at_fn_check_prepare_dynamic "grep '^exception caught: printer$' stderr" "c++.at:1362" ( $at_check_trace; grep '^exception caught: printer$' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaae" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaae" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaae ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaaE" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaE" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaaE ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error, unexpected end of file, expecting 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaaT" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaT" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaaT ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: \$PREPARSER ./input aaaaR" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaR" "c++.at:1362" ( $at_check_trace; $PREPARSER ./input aaaaR ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1362: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1362" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1362" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_687 #AT_START_688 at_fn_group_banner 688 'c++.at:1363' \ "Exception safety without error recovery api.value.type=variant" "" 27 at_xfail=no ( printf "%s\n" "688. $at_setup_line: testing $at_desc ..." $at_traceon cat >exceptions.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include #include void foo () { try { throw std::runtime_error ("foo"); } catch (...) { std::cerr << "Inner caught\n"; throw; } } int main () { try { foo (); } catch (...) { std::cerr << "Outer caught\n"; return 0; } return 1; } _ATEOF printf "%s\n" "c++.at:1363" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1363" { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o exceptions exceptions.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS" "c++.at:1363" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o exceptions exceptions.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # The "empty" quadrigraph is to protect from cfg.mk's sc_at_parser_check. { set +x printf "%s\n" "$at_srcdir/c++.at:1363: ./exceptions || exit 77" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; ./exceptions || exit 77 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %debug %define parse.error verbose %define api.value.type variant %code requires { #include #include // size_t and getenv. #include #include #include bool debug = false; /// A class that tracks its instances. struct Object { char val; Object () : val ('?') { log (this, "Object::Object"); Object::instances.insert (this); } Object (const Object& that) : val (that.val) { log (this, "Object::Object"); Object::instances.insert (this); } Object (char v) : val (v) { log (this, "Object::Object"); Object::instances.insert (this); } ~Object () { log (this, "Object::~Object"); objects::iterator i = instances.find (this); // Make sure this object is alive. assert (i != instances.end ()); Object::instances.erase (i); } Object& operator= (const Object& that) { val = that.val; return *this; } Object& operator= (char v) { val = v; return *this; } // Static part. typedef std::set objects; static objects instances; static bool empty () { return instances.empty (); } static void log (Object const *o, const std::string& msg) { if (debug) { if (o) std::cerr << o << "->"; std::cerr << msg << " {"; const char* sep = " "; for (objects::const_iterator i = instances.begin(), i_end = instances.end(); i != i_end; ++i) { std::cerr << sep << *i; sep = ", "; } std::cerr << " }\n"; } } }; } %code { #include #include // strchr #include int yylex (yy::parser::semantic_type *); Object::objects Object::instances; static char const *input; } %printer { yyo << &$$ << " '" << $$.val << '\''; if ($$.val == 'p') throw std::runtime_error ("printer"); } ; %token 'a' 'E' 'e' 'p' 'R' 's' 'T' %type list item %initial-action { if (strchr (input, 'i')) throw std::runtime_error ("initial-action"); } %% start: list {}; list: item { $$ = $1; } // Right recursion to load the stack. | item list { $$ = $1; } ; item: 'a' { $$ = $1; } | 'e' { YY_USE ($$); YY_USE ($1); error ("syntax error"); } // Not just 'E', otherwise we reduce when 'E' is the lookahead, and // then the stack is emptied, defeating the point of the test. | 'E' 'a' { YY_USE ($1); $$ = $2; } | 'R' { YYERROR; } | 'p' { $$ = $1; } | 's' { $$ = $1; throw std::runtime_error ("reduction"); } | 'T' { YYABORT; } ; %% int yylex (yy::parser::semantic_type *lvalp) { // 'a': no error. // 'e': user action calls error. // 'E': syntax error, with yyerror that throws. // 'i': initial action throws. // 'l': yylex throws. // 'R': call YYERROR in the action // 's': reduction throws. // 'T': call YYABORT in the action switch (char res = *input++) { case 'l': throw std::runtime_error ("yylex"); default: lvalp->build (res); goto zero; zero: case 0: return res; } } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { throw std::runtime_error (m); } int main (int argc, const char *argv[]) { switch (argc) { case 2: input = argv[1]; break; case 3: assert (std::string(argv[1]) == "--debug"); debug = 1; input = argv[2]; break; default: abort (); } yy::parser parser; debug |= !!getenv ("YYDEBUG"); parser.set_debug_level (debug); int res = 2; try { res = parser.parse (); } catch (const std::exception& e) { std::cerr << "exception caught: " << e.what () << '\n'; } catch (...) { std::cerr << "unknown exception caught\n"; } Object::log (YY_NULLPTR, "end"); assert (Object::empty()); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc --report=all input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy" "c++.at:1363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1363" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1363: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc --report=all input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1363" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1363" { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:1363" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaas" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaas" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaas ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: reduction " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaal" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaal" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaal ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: yylex " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input i" at_fn_check_prepare_dynamic " $PREPARSER ./input i" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input i ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: initial-action " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaap" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input --debug aaaap" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug aaaap" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input --debug aaaap ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: grep '^exception caught: printer\$' stderr" at_fn_check_prepare_dynamic "grep '^exception caught: printer$' stderr" "c++.at:1363" ( $at_check_trace; grep '^exception caught: printer$' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaae" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaae" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaae ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaaE" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaE" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaaE ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "exception caught: syntax error, unexpected end of file, expecting 'a' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaaT" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaT" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaaT ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: \$PREPARSER ./input aaaaR" at_fn_check_prepare_dynamic " $PREPARSER ./input aaaaR" "c++.at:1363" ( $at_check_trace; $PREPARSER ./input aaaaR ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1363: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1363" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1363" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_688 #AT_START_689 at_fn_group_banner 689 'c++.at:1371' \ "C++ GLR parser identifier shadowing" " " 27 at_xfail=no ( printf "%s\n" "689. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "glr.cc" %union { int ival; } %token ZERO; %code { int yylex (yy::parser::semantic_type *lvalp); } %% exp: ZERO %% int yylex (yy::parser::semantic_type *lvalp) { // Note: this argument is unused, but named on purpose. There used to be a // bug with a macro that erroneously expanded this identifier to // yystackp->yyval. YY_USE (lvalp); return yy::parser::token::ZERO; } void yy::parser::error (std::string const&) {} int main () {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1410" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy" "c++.at:1410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1410" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1410: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1410" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1410" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1410: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1410" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1410" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1410: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1410" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1410" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy" at_fn_check_prepare_trace "c++.at:1410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1410" $at_failed && at_fn_log_failure $at_traceon; } at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" printf "%s\n" "c++.at:1411" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1411" { set +x printf "%s\n" "$at_srcdir/c++.at:1411: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "c++.at:1411" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1411" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_689 #AT_START_690 at_fn_group_banner 690 'c++.at:1422' \ "Shared locations" " " 27 at_xfail=no ( printf "%s\n" "690. $at_setup_line: testing $at_desc ..." $at_traceon # AT_TEST([PREFIX], [DIRECTIVES]) # ------------------------------- # Generate and compile to *.o. Make sure there is no (allowed) YY* # nor yy* identifiers in the header after applying api.prefix. Check # that headers can be compiled by a C++ compiler. mkdir -p include/ast cat >x1.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.namespace {x1} %header %locations %define api.location.file "include/ast/loc.hh" %define api.location.include {} %code { static int yylex (x1::parser::value_type *lvalp, x1::parser::location_type *llocp); } %% exp: '0'; %% /* A C++ error reporting function. */ void x1::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (x1::parser::value_type *lvalp, x1::parser::location_type *llocp) { static char const input[] = "0"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o x1.cc x1.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o x1.cc x1.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o x1.cc x1.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o x1.cc x1.yy" "c++.at:1456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o x1.cc x1.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1456: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1456" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1456: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1456" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1456: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1456" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o x1.cc x1.yy" at_fn_check_prepare_trace "c++.at:1456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o x1.cc x1.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:1456" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1456" { set +x printf "%s\n" "$at_srcdir/c++.at:1456: \$CXX \$CPPFLAGS \$CXXFLAGS -Iinclude -c -o x1.o x1.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -Iinclude -c -o x1.o x1.cc " "c++.at:1456" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -Iinclude -c -o x1.o x1.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1456" $at_failed && at_fn_log_failure $at_traceon; } # Check the CPP guard and Doxyen comments. { set +x printf "%s\n" "$at_srcdir/c++.at:1463: sed -ne '/INCLUDED/p;/\\\\file/{p;n;p;}' include/ast/loc.hh" at_fn_check_prepare_trace "c++.at:1463" ( $at_check_trace; sed -ne '/INCLUDED/p;/\\file/{p;n;p;}' include/ast/loc.hh ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" " ** \\file ast/loc.hh ** Define the x1::location class. #ifndef YY_YY_AST_LOC_HH_INCLUDED # define YY_YY_AST_LOC_HH_INCLUDED #endif // !YY_YY_AST_LOC_HH_INCLUDED " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1463" $at_failed && at_fn_log_failure $at_traceon; } cat >x2.yy <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %skeleton "lalr1.cc" %define api.namespace {x2} %header %locations %code requires {#include } %define api.location.type {x1::location} %code { static int yylex (x2::parser::value_type *lvalp, x2::parser::location_type *llocp); } %% exp: '0'; %% /* A C++ error reporting function. */ void x2::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } #include static int yylex (x2::parser::value_type *lvalp, x2::parser::location_type *llocp) { static char const input[] = "0"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1471: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o x2.cc x2.yy" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1471" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o x2.cc x2.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1471: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o x2.cc x2.yy" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o x2.cc x2.yy" "c++.at:1471" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o x2.cc x2.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1471: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1471" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1471: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1471" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1471: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1471" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1471: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o x2.cc x2.yy" at_fn_check_prepare_trace "c++.at:1471" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o x2.cc x2.yy ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:1471" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1471" { set +x printf "%s\n" "$at_srcdir/c++.at:1471: \$CXX \$CPPFLAGS \$CXXFLAGS -Iinclude -c -o x2.o x2.cc " at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -Iinclude -c -o x2.o x2.cc " "c++.at:1471" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -Iinclude -c -o x2.o x2.cc ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1471" $at_failed && at_fn_log_failure $at_traceon; } cat >main.cc <<'_ATEOF' /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include #include "x1.hh" #include "x2.hh" #define RUN(S) \ do { \ S::parser parser; \ int res = parser.parse(); \ if (res) \ std::cerr << #S": " << res << '\n'; \ } while (false) int main (void) { RUN(x1); RUN(x2); } _ATEOF # main.cc printf "%s\n" "c++.at:1501" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1501" { set +x printf "%s\n" "$at_srcdir/c++.at:1501: \$CXX \$CPPFLAGS \$CXXFLAGS -Iinclude \$LDFLAGS -o parser x[12].o main.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS -Iinclude $LDFLAGS -o parser x[12].o main.cc $LIBS" "c++.at:1501" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS -Iinclude $LDFLAGS -o parser x[12].o main.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1501" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1502: \$PREPARSER ./parser" at_fn_check_prepare_dynamic " $PREPARSER ./parser" "c++.at:1502" ( $at_check_trace; $PREPARSER ./parser ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1502" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1502: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1502" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1502" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_690 #AT_START_691 at_fn_group_banner 691 'c++.at:1517' \ "Default action" " " 27 at_xfail=no ( printf "%s\n" "691. $at_setup_line: testing $at_desc ..." $at_traceon cat >test.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { #include // unique_ptr } %code { static yy::parser::symbol_type yylex (); } %skeleton "lalr1.cc" %define api.token.constructor %define api.value.type variant %define api.value.automove %token ONE TWO EOI 0 %type > ONE TWO one two one.opt two.opt %% exp: one.opt two.opt { std::cout << *$1 << ", " << *$2 << '\n'; } one.opt: one | %empty {} two.opt: two | %empty {} one: ONE two: TWO %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static yy::parser::symbol_type yylex () { static char const input[] = "12"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == '1') return yy::parser::make_ONE (std::make_unique (10)); else if (res == '2') return yy::parser::make_TWO (std::make_unique (20)); else return yy::parser::make_EOI (); ; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF at_for_each_std_CXXFLAGS_save=$CXXFLAGS for at_std in '' \ ${CXX98_CXXFLAGS:+"$CXX98_CXXFLAGS"} \ ${CXX03_CXXFLAGS:+"$CXX03_CXXFLAGS"} \ ${CXX11_CXXFLAGS:+"$CXX11_CXXFLAGS"} \ ${CXX14_CXXFLAGS:+"$CXX14_CXXFLAGS"} \ ${CXX17_CXXFLAGS:+"$CXX17_CXXFLAGS"} \ ${CXX20_CXXFLAGS:+"$CXX20_CXXFLAGS"} \ ${CXX2B_CXXFLAGS:+"$CXX2B_CXXFLAGS"} do printf "%s\n" "======== Testing with C++ standard flags: '$at_cxx_std'" CXXFLAGS="$at_for_each_std_CXXFLAGS_save $at_std" cat >check.cc <<'_ATEOF' int main () { #if !defined __cplusplus || __cplusplus < 201402 return 1; #else return 0; #endif } _ATEOF printf "%s\n" "c++.at:1555" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1555" { set +x printf "%s\n" "$at_srcdir/c++.at:1555: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o check check.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS" "c++.at:1555" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o check check.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1555: ./check" at_fn_check_prepare_trace "c++.at:1555" ( $at_check_trace; ./check ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } if test $at_status != 0; then echo "$at_std not supported"; continue fi if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/c++.at:1555: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -fcaret -o test.cc test.y" at_fn_check_prepare_notrace 'an embedded newline' "c++.at:1555" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -fcaret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1555: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o test.cc test.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o test.cc test.y" "c++.at:1555" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -fcaret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/c++.at:1555: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1555" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/c++.at:1555: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "c++.at:1555" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/c++.at:1555: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "c++.at:1555" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/c++.at:1555: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o test.cc test.y" at_fn_check_prepare_trace "c++.at:1555" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -fcaret -o test.cc test.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "c++.at:1555" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/c++.at:1555" { set +x printf "%s\n" "$at_srcdir/c++.at:1555: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o test test.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS" "c++.at:1555" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o test test.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1555: \$PREPARSER ./test" at_fn_check_prepare_dynamic " $PREPARSER ./test" "c++.at:1555" ( $at_check_trace; $PREPARSER ./test ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "10, 20 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/c++.at:1555: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "c++.at:1555" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/c++.at:1555" $at_failed && at_fn_log_failure $at_traceon; } done CXXFLAGS=$at_for_each_std_CXXFLAGS_save set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_691 #AT_START_692 at_fn_group_banner 692 'java.at:25' \ "Java invalid directives" " " 28 at_xfail=no ( printf "%s\n" "692. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %header %destructor { /* Nothing. */ } exp %% exp: _ATEOF { set +x printf "%s\n" "$at_srcdir/java.at:35: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret YYParser.y" "java.at:35" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "YYParser.y: error: %header/%defines does not make sense in Java YYParser.y:4.13-30: error: %destructor does not make sense in Java 4 | %destructor { /* Nothing. */ } exp | ^~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/java.at:35" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %defines %destructor { /* Nothing. */ } exp %% exp: _ATEOF { set +x printf "%s\n" "$at_srcdir/java.at:50: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret YYParser.y" "java.at:50" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -fcaret YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "YYParser.y: error: %header/%defines does not make sense in Java YYParser.y:4.13-30: error: %destructor does not make sense in Java 4 | %destructor { /* Nothing. */ } exp | ^~~~~~~~~~~~~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/java.at:50" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_692 #AT_START_693 at_fn_group_banner 693 'java.at:186' \ "Java parser class and package names" " " 29 at_xfail=no ( printf "%s\n" "693. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:188: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:188" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:188: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:188" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:188: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:188" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:188: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:188" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:188: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:188" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:188: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:188" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:188: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:188" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:188" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:188" printf "%s\n" "java.at:188" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:188" { set +x printf "%s\n" "$at_srcdir/java.at:188: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:188" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:188" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:189: grep -c '^class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class YYParser$' YYParser.java" "java.at:189" ( $at_check_trace; grep -c '^class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:189" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %name-prefix "Prefix" %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:191: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:191" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:191: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:191" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:191" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:191" printf "%s\n" "java.at:191" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:191" { set +x printf "%s\n" "$at_srcdir/java.at:191: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:191" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:192: grep -c '^class PrefixParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class PrefixParser$' YYParser.java" "java.at:192" ( $at_check_trace; grep -c '^class PrefixParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:192" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.prefix {Prefix} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:194: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:194" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:194: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:194" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:194: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:194" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:194: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:194" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:194: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:194" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:194" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:194" printf "%s\n" "java.at:194" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:194" { set +x printf "%s\n" "$at_srcdir/java.at:194: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:194" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:194" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:195: grep -c '^class PrefixParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class PrefixParser$' YYParser.java" "java.at:195" ( $at_check_trace; grep -c '^class PrefixParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:195" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.token.prefix {TOK_} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:197: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:197" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:197: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:197" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:197: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:197" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:197: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:197" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:197: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:197" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:197: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:197" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:197: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:197" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:197" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:197" printf "%s\n" "java.at:197" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:197" { set +x printf "%s\n" "$at_srcdir/java.at:197: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:197" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:197" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:198: grep -c '^.*TOK_END.*\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^.*TOK_END.*$' YYParser.java" "java.at:198" ( $at_check_trace; grep -c '^.*TOK_END.*$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:198" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.parser.class {ParserClassName} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:200: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:200" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:200: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:200" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:200: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:200" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:200: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:200" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:200: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:200" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:200: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:200" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:200: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:200" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:200" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:200" printf "%s\n" "java.at:200" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:200" { set +x printf "%s\n" "$at_srcdir/java.at:200: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:200" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:200" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:201: grep -c '^class ParserClassName\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class ParserClassName$' YYParser.java" "java.at:201" ( $at_check_trace; grep -c '^class ParserClassName$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:201" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.package {user_java_package} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:203: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:203" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:203: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:203" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:203: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:203" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:203: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:203" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:203: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:203" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:203: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:203" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:203: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:203" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:203" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:203" printf "%s\n" "java.at:203" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:203" { set +x printf "%s\n" "$at_srcdir/java.at:203: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:203" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:203" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:204: grep -c '^package user_java_package;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^package user_java_package;$' YYParser.java" "java.at:204" ( $at_check_trace; grep -c '^package user_java_package;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:204" $at_failed && at_fn_log_failure $at_traceon; } # Backward compatibility. cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define package {user_java_package} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:207: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:207" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:207: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:207" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:207: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:207" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:207: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:207" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:207: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:207" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:207: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:207" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:207: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:207" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:207" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:207" printf "%s\n" "java.at:207" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:207" { set +x printf "%s\n" "$at_srcdir/java.at:207: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:207" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:208: grep -c '^package user_java_package;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^package user_java_package;$' YYParser.java" "java.at:208" ( $at_check_trace; grep -c '^package user_java_package;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:208" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_693 #AT_START_694 at_fn_group_banner 694 'java.at:217' \ "Java parser class modifiers" " " 29 at_xfail=no ( printf "%s\n" "694. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define abstract %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:219: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:219" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:219: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:219" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:219: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:219" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:219: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:219" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:219: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:219" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:219: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:219" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:219: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:219" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:219" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:219" printf "%s\n" "java.at:219" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:219" { set +x printf "%s\n" "$at_srcdir/java.at:219: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:219" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:219" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:220: grep -c '^abstract class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^abstract class YYParser$' YYParser.java" "java.at:220" ( $at_check_trace; grep -c '^abstract class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:220" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define final %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:222: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:222" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:222: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:222" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:222: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:222" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:222: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:222" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:222: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:222" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:222: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:222" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:222: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:222" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:222" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:222" printf "%s\n" "java.at:222" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:222" { set +x printf "%s\n" "$at_srcdir/java.at:222: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:222" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:222" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:223: grep -c '^final class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^final class YYParser$' YYParser.java" "java.at:223" ( $at_check_trace; grep -c '^final class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:223" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:225: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:225" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:225: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:225" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:225: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:225" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:225: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:225" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:225: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:225" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:225: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:225" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:225: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:225" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:225" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:225" printf "%s\n" "java.at:225" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:225" { set +x printf "%s\n" "$at_srcdir/java.at:225: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:225" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:225" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:226: grep -c '^strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^strictfp class YYParser$' YYParser.java" "java.at:226" ( $at_check_trace; grep -c '^strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:226" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define abstract %define strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:228: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:228" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:228: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:228" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:228: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:228" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:228: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:228" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:228: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:228" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:228: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:228" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:228: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:228" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:228" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:228" printf "%s\n" "java.at:228" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:228" { set +x printf "%s\n" "$at_srcdir/java.at:228: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:228" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:228" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:231: grep -c '^abstract strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^abstract strictfp class YYParser$' YYParser.java" "java.at:231" ( $at_check_trace; grep -c '^abstract strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:231" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define final %define strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:233: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:233" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:233: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:233" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:233: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:233" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:233: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:233" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:233: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:233" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:233" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:233" printf "%s\n" "java.at:233" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:233" { set +x printf "%s\n" "$at_srcdir/java.at:233: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:233" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:233" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:236: grep -c '^final strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^final strictfp class YYParser$' YYParser.java" "java.at:236" ( $at_check_trace; grep -c '^final strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:236" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define public %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:238: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:238" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:238: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:238" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:238: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:238" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:238: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:238" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:238: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:238" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:238: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:238" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:238: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:238" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:238" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:238" printf "%s\n" "java.at:238" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:238" { set +x printf "%s\n" "$at_srcdir/java.at:238: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:238" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:238" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:239: grep -c '^public class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public class YYParser$' YYParser.java" "java.at:239" ( $at_check_trace; grep -c '^public class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:239" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define public %define abstract %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:241: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:241" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:241: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:241" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:241: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:241" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:241: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:241" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:241: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:241" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:241: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:241" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:241: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:241" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:241" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:241" printf "%s\n" "java.at:241" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:241" { set +x printf "%s\n" "$at_srcdir/java.at:241: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:241" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:241" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:244: grep -c '^public abstract class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public abstract class YYParser$' YYParser.java" "java.at:244" ( $at_check_trace; grep -c '^public abstract class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:244" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define public %define final %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:246: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:246" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:246: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:246" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:246: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:246" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:246: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:246" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:246: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:246" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:246" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:246" printf "%s\n" "java.at:246" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:246" { set +x printf "%s\n" "$at_srcdir/java.at:246: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:246" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:246" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:249: grep -c '^public final class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public final class YYParser$' YYParser.java" "java.at:249" ( $at_check_trace; grep -c '^public final class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:249" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define public %define strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:251: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:251" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:251: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:251" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:251: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:251" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:251: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:251" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:251: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:251" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:251: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:251" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:251: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:251" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:251" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:251" printf "%s\n" "java.at:251" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:251" { set +x printf "%s\n" "$at_srcdir/java.at:251: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:251" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:251" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:254: grep -c '^public strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public strictfp class YYParser$' YYParser.java" "java.at:254" ( $at_check_trace; grep -c '^public strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:254" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define public %define abstract %define strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:256: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:256" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:256: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:256" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:256: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:256" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:256: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:256" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:256: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:256" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:256: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:256" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:256: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:256" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:256" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:256" printf "%s\n" "java.at:256" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:256" { set +x printf "%s\n" "$at_srcdir/java.at:256: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:256" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:256" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:260: grep -c '^public abstract strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public abstract strictfp class YYParser$' YYParser.java" "java.at:260" ( $at_check_trace; grep -c '^public abstract strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:260" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define public %define final %define strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:262: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:262" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:262: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:262" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:262: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:262" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:262: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:262" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:262: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:262" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:262: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:262" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:262: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:262" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:262" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:262" printf "%s\n" "java.at:262" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:262" { set +x printf "%s\n" "$at_srcdir/java.at:262: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:262" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:262" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:266: grep -c '^public final strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public final strictfp class YYParser$' YYParser.java" "java.at:266" ( $at_check_trace; grep -c '^public final strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:266" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.parser.public %define api.parser.final %define api.parser.strictfp %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:268: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:268" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:268: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:268" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:268: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:268" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:268: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:268" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:268: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:268" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:268: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:268" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:268: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:268" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:268" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:268" printf "%s\n" "java.at:268" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:268" { set +x printf "%s\n" "$at_srcdir/java.at:268: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:268" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:268" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:272: grep -c '^public final strictfp class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^public final strictfp class YYParser$' YYParser.java" "java.at:272" ( $at_check_trace; grep -c '^public final strictfp class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:272" $at_failed && at_fn_log_failure $at_traceon; } # FIXME: Can't do a Java compile because javacomp.sh is configured for 1.3 cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define annotations {/*@Deprecated @SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "deprecation"}) @SuppressWarnings(value={"unchecked", "deprecation"})*/} %define public %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:275: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:275" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:275: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:275" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:275: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:275" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:275: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:275" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:275: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:275" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:275: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:275" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:275: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:275" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:275" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:275" printf "%s\n" "java.at:275" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:275" { set +x printf "%s\n" "$at_srcdir/java.at:275: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:275" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:275" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:278: grep -c '^/\\*@Deprecated @SuppressWarnings(\"unchecked\") @SuppressWarnings({\"unchecked\", \"deprecation\"}) @SuppressWarnings(value={\"unchecked\", \"deprecation\"})\\*/ public class YYParser\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^/\\*@Deprecated @SuppressWarnings(\"unchecked\") @SuppressWarnings({\"unchecked\", \"deprecation\"}) @SuppressWarnings(value={\"unchecked\", \"deprecation\"})\\*/ public class YYParser$' YYParser.java" "java.at:278" ( $at_check_trace; grep -c '^/\*@Deprecated @SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "deprecation"}) @SuppressWarnings(value={"unchecked", "deprecation"})\*/ public class YYParser$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:278" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_694 #AT_START_695 at_fn_group_banner 695 'java.at:287' \ "Java parser class extends and implements" " " 29 at_xfail=no ( printf "%s\n" "695. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define extends {Thread} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:289: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:289" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:289: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:289" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:289: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:289" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:289: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:289" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:289: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:289" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:289: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:289" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:289: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:289" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:289" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:289" printf "%s\n" "java.at:289" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:289" { set +x printf "%s\n" "$at_srcdir/java.at:289: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:289" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:289" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:290: grep -c '^class YYParser extends Thread\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class YYParser extends Thread$' YYParser.java" "java.at:290" ( $at_check_trace; grep -c '^class YYParser extends Thread$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:290" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define implements {Cloneable} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:292: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:292" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:292: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:292" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:292: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:292" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:292: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:292" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:292: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:292" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:292: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:292" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:292: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:292" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:292" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:292" printf "%s\n" "java.at:292" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:292" { set +x printf "%s\n" "$at_srcdir/java.at:292: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:292" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:292" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:293: grep -c '^class YYParser implements Cloneable\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class YYParser implements Cloneable$' YYParser.java" "java.at:293" ( $at_check_trace; grep -c '^class YYParser implements Cloneable$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:293" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define extends {Thread} %define implements {Cloneable} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:295: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:295" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:295: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:295" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:295: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:295" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:295: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:295" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:295: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:295" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:295: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:295" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:295: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:295" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:295" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:295" printf "%s\n" "java.at:295" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:295" { set +x printf "%s\n" "$at_srcdir/java.at:295: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:295" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:295" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:298: grep -c '^class YYParser extends Thread implements Cloneable\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^class YYParser extends Thread implements Cloneable$' YYParser.java" "java.at:298" ( $at_check_trace; grep -c '^class YYParser extends Thread implements Cloneable$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:298" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_695 #AT_START_696 at_fn_group_banner 696 'java.at:307' \ "Java %parse-param and %lex-param" " " 29 at_xfail=no ( printf "%s\n" "696. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:309: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:309" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:309: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:309" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:309: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:309" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:309: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:309" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:309: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:309" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:309: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:309" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:309: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:309" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:309" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:309" printf "%s\n" "java.at:309" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:309" { set +x printf "%s\n" "$at_srcdir/java.at:309: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:309" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:309" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:310: grep -c '^ *public YYParser(Lexer yylexer) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(Lexer yylexer) *$' YYParser.java" "java.at:310" ( $at_check_trace; grep -c '^ *public YYParser(Lexer yylexer) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:310" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %parse-param {int parse_param1} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:312: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:312" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:312: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:312" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:312: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:312" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:312: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:312" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:312: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:312" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:312: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:312" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:312: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:312" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:312" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:312" printf "%s\n" "java.at:312" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:312" { set +x printf "%s\n" "$at_srcdir/java.at:312: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:312" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:312" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:313: grep -c '^ *protected final int parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final int parse_param1;$' YYParser.java" "java.at:313" ( $at_check_trace; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:313" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:314: grep -c '^ *public YYParser(Lexer yylexer, *int parse_param1) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(Lexer yylexer, *int parse_param1) *$' YYParser.java" "java.at:314" ( $at_check_trace; grep -c '^ *public YYParser(Lexer yylexer, *int parse_param1) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:314" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:315: grep -c '^ *this.parse_param1 = parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java" "java.at:315" ( $at_check_trace; grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:315" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %parse-param {int parse_param1} %parse-param {long parse_param2} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:317: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:317" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:317: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:317" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:317: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:317" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:317: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:317" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:317: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:317" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:317" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:317" printf "%s\n" "java.at:317" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:317" { set +x printf "%s\n" "$at_srcdir/java.at:317: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:317" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:317" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:320: grep -c '^ *protected final int parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final int parse_param1;$' YYParser.java" "java.at:320" ( $at_check_trace; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:320" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:321: grep -c '^ *protected final long parse_param2;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final long parse_param2;$' YYParser.java" "java.at:321" ( $at_check_trace; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:321" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:322: grep -c '^ *public YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *$' YYParser.java" "java.at:322" ( $at_check_trace; grep -c '^ *public YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:322" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:323: grep -c '^ *this.parse_param1 = parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java" "java.at:323" ( $at_check_trace; grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:323" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:324: grep -c '^ *this.parse_param2 = parse_param2;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param2 = parse_param2;$' YYParser.java" "java.at:324" ( $at_check_trace; grep -c '^ *this.parse_param2 = parse_param2;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:324" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:326: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:326" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:326: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:326" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:326: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:326" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:326: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:326" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:326" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:326" printf "%s\n" "java.at:326" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:326" { set +x printf "%s\n" "$at_srcdir/java.at:326: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:326" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:326" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:327: grep -c '^ *public YYParser() *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser() *$' YYParser.java" "java.at:327" ( $at_check_trace; grep -c '^ *public YYParser() *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:327" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:328: grep -c '^ *protected YYParser(Lexer yylexer) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected YYParser(Lexer yylexer) *$' YYParser.java" "java.at:328" ( $at_check_trace; grep -c '^ *protected YYParser(Lexer yylexer) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:328" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %parse-param {int parse_param1} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:330: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:330" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:330: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:330" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:330: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:330" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:330: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:330" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:330: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:330" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:330" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:330" printf "%s\n" "java.at:330" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:330" { set +x printf "%s\n" "$at_srcdir/java.at:330: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:330" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:330" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:332: grep -c '^ *protected final int parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final int parse_param1;$' YYParser.java" "java.at:332" ( $at_check_trace; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:332" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:333: grep -c '^ *public YYParser(int parse_param1) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(int parse_param1) *$' YYParser.java" "java.at:333" ( $at_check_trace; grep -c '^ *public YYParser(int parse_param1) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:333" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:334: grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1) *$' YYParser.java" "java.at:334" ( $at_check_trace; grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:334" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:335: grep -c '^ *this.parse_param1 = parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java" "java.at:335" ( $at_check_trace; grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:335" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %parse-param {int parse_param1} %parse-param {long parse_param2} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:337: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:337" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:337: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:337" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:337: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:337" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:337: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:337" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:337" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:337" printf "%s\n" "java.at:337" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:337" { set +x printf "%s\n" "$at_srcdir/java.at:337: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:337" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:337" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:341: grep -c '^ *protected final int parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final int parse_param1;$' YYParser.java" "java.at:341" ( $at_check_trace; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:341" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:342: grep -c '^ *protected final long parse_param2;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final long parse_param2;$' YYParser.java" "java.at:342" ( $at_check_trace; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:342" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:343: grep -c '^ *public YYParser(int parse_param1, *long parse_param2) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(int parse_param1, *long parse_param2) *$' YYParser.java" "java.at:343" ( $at_check_trace; grep -c '^ *public YYParser(int parse_param1, *long parse_param2) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:343" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:344: grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *$' YYParser.java" "java.at:344" ( $at_check_trace; grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:344" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:345: grep -c '^ *this.parse_param1 = parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java" "java.at:345" ( $at_check_trace; grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:345" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:346: grep -c '^ *this.parse_param2 = parse_param2;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param2 = parse_param2;$' YYParser.java" "java.at:346" ( $at_check_trace; grep -c '^ *this.parse_param2 = parse_param2;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:346" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %lex-param {char lex_param1} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } YYLexer (char lex_param1) {} } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:348: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:348" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:348: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:348" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:348: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:348" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:348: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:348" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:348: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:348" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:348: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:348" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:348: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:348" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:348" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:348" printf "%s\n" "java.at:348" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:348" { set +x printf "%s\n" "$at_srcdir/java.at:348: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:348" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:348" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:350: grep -c '^ *public YYParser(char lex_param1) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(char lex_param1) *$' YYParser.java" "java.at:350" ( $at_check_trace; grep -c '^ *public YYParser(char lex_param1) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:350" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:351: grep -c '^.* = new YYLexer *(lex_param1);\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^.* = new YYLexer *(lex_param1);$' YYParser.java" "java.at:351" ( $at_check_trace; grep -c '^.* = new YYLexer *(lex_param1);$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:351" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %lex-param {char lex_param1} %lex-param {short lex_param2} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } YYLexer (char lex_param1, short lex_param2) {} } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:353: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:353" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:353: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:353" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:353: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:353" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:353: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:353" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:353: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:353" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:353: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:353" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:353: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:353" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:353" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:353" printf "%s\n" "java.at:353" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:353" { set +x printf "%s\n" "$at_srcdir/java.at:353: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:353" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:353" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:357: grep -c '^ *public YYParser(char lex_param1, *short lex_param2) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(char lex_param1, *short lex_param2) *$' YYParser.java" "java.at:357" ( $at_check_trace; grep -c '^ *public YYParser(char lex_param1, *short lex_param2) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:357" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:358: grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java" "java.at:358" ( $at_check_trace; grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:358" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %parse-param {int parse_param1} %parse-param {long parse_param2} %lex-param {char lex_param1} %lex-param {short lex_param2} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } YYLexer (char lex_param1, short lex_param2) {} } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:360: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:360" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:360: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:360" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:360: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:360" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:360: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:360" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:360: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:360" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:360" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:360" printf "%s\n" "java.at:360" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:360" { set +x printf "%s\n" "$at_srcdir/java.at:360: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:360" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:360" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:366: grep -c '^ *protected final int parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final int parse_param1;$' YYParser.java" "java.at:366" ( $at_check_trace; grep -c '^ *protected final int parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:366" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:367: grep -c '^ *protected final long parse_param2;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected final long parse_param2;$' YYParser.java" "java.at:367" ( $at_check_trace; grep -c '^ *protected final long parse_param2;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:367" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:368: grep -c '^ *public YYParser(char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public YYParser(char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) *$' YYParser.java" "java.at:368" ( $at_check_trace; grep -c '^ *public YYParser(char lex_param1, *short lex_param2, *int parse_param1, *long parse_param2) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:368" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:369: grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java" "java.at:369" ( $at_check_trace; grep -c '^.* = new YYLexer *(lex_param1, *lex_param2);$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:369" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:370: grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *$' YYParser.java" "java.at:370" ( $at_check_trace; grep -c '^ *protected YYParser(Lexer yylexer, *int parse_param1, *long parse_param2) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:370" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:371: grep -c '^ *this.parse_param1 = parse_param1;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java" "java.at:371" ( $at_check_trace; grep -c '^ *this.parse_param1 = parse_param1;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:371" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:372: grep -c '^ *this.parse_param2 = parse_param2;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *this.parse_param2 = parse_param2;$' YYParser.java" "java.at:372" ( $at_check_trace; grep -c '^ *this.parse_param2 = parse_param2;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "2 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:372" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_696 #AT_START_697 at_fn_group_banner 697 'java.at:381' \ "Java throws specifications" " " 29 at_xfail=no ( printf "%s\n" "697. $at_setup_line: testing $at_desc ..." $at_traceon # %define throws - 0 1 2 # %define lex-throws - 0 1 2 # %code lexer 0 1 cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %initial-action {if (true) throw new ClassNotFoundException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %initial-action {if (true) throw new InstantiationException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define lex_throws {} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %define lex_throws {} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %define lex_throws {} %initial-action {if (true) throw new ClassNotFoundException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %define lex_throws {} %initial-action {if (true) throw new InstantiationException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define lex_throws {InterruptedException} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %define lex_throws {InterruptedException} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %define lex_throws {InterruptedException} %initial-action {if (true) throw new ClassNotFoundException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %define lex_throws {InterruptedException} %initial-action {if (true) throw new InstantiationException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define lex_throws {InterruptedException, IllegalAccessException} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %define lex_throws {InterruptedException, IllegalAccessException} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %define lex_throws {InterruptedException, IllegalAccessException} %initial-action {if (true) throw new ClassNotFoundException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %define lex_throws {InterruptedException, IllegalAccessException} %initial-action {if (true) throw new InstantiationException();} %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws java.io.IOException { throw new java.io.IOException(); } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws java.io.IOException { throw new java.io.IOException(); } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %initial-action {if (true) throw new ClassNotFoundException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws java.io.IOException { throw new java.io.IOException(); } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %initial-action {if (true) throw new InstantiationException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws java.io.IOException { throw new java.io.IOException(); } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws java.io.IOException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws java.io.IOException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws java.io.IOException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define lex_throws {} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %define lex_throws {} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %define lex_throws {} %initial-action {if (true) throw new ClassNotFoundException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %define lex_throws {} %initial-action {if (true) throw new InstantiationException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define lex_throws {InterruptedException} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException { throw new InterruptedException(); } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %define lex_throws {InterruptedException} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException { throw new InterruptedException(); } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %define lex_throws {InterruptedException} %initial-action {if (true) throw new ClassNotFoundException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException { throw new InterruptedException(); } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %define lex_throws {InterruptedException} %initial-action {if (true) throw new InstantiationException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException { throw new InterruptedException(); } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define lex_throws {InterruptedException, IllegalAccessException} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException, IllegalAccessException { throw new IllegalAccessException(); } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {} %define lex_throws {InterruptedException, IllegalAccessException} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException, IllegalAccessException { throw new IllegalAccessException(); } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException} %define lex_throws {InterruptedException, IllegalAccessException} %initial-action {if (true) throw new ClassNotFoundException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException, IllegalAccessException { throw new IllegalAccessException(); } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define throws {ClassNotFoundException, InstantiationException} %define lex_throws {InterruptedException, IllegalAccessException} %initial-action {if (true) throw new InstantiationException();} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() throws InterruptedException, IllegalAccessException { throw new IllegalAccessException(); } } %% start: END {throw new ClassNotFoundException();}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:441: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:441: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:441" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:441: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:441" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" printf "%s\n" "java.at:441" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:441" { set +x printf "%s\n" "$at_srcdir/java.at:441: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:441" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *int yylex() throws InterruptedException, IllegalAccessException *;$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *private int yyaction([^)]*) throws ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:441: grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *\$' YYParser.java" at_fn_check_prepare_dynamic "grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java" "java.at:441" ( $at_check_trace; grep -c '^ *public boolean parse() throws InterruptedException, IllegalAccessException, ClassNotFoundException, InstantiationException *$' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/java.at:441" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_697 #AT_START_698 at_fn_group_banner 698 'java.at:470' \ "Java constructor init and init_throws" " " 29 at_xfail=no ( printf "%s\n" "698. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define extends {Thread} %code init { super("Test Thread"); if (true) throw new InterruptedException(); } %define init_throws {InterruptedException} %lex-param {int lex_param} %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:475: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:475" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:475: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:475" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:475: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:475" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:475: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:475" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:475: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:475" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:475: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:475" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:475: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:475" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:475" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:475" printf "%s\n" "java.at:475" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:475" { set +x printf "%s\n" "$at_srcdir/java.at:475: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:475" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:475" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:480: grep 'super(\"Test Thread\"); if (true) throw new InterruptedException();' YYParser.java" at_fn_check_prepare_trace "java.at:480" ( $at_check_trace; grep 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:480" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define extends {Thread} %code init { super("Test Thread"); if (true) throw new InterruptedException(); } %define init_throws {InterruptedException} %code lexer { Object yylval; public Object getLVal() { return yylval; } public Position getStartPos() { return null; } public Position getEndPos() { return null; } public void yyerror (Location loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {}; %% class Position {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:482: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:482" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:482: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:482" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:482: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:482" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:482: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:482" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:482: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:482" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:482" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:482" printf "%s\n" "java.at:482" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:482" { set +x printf "%s\n" "$at_srcdir/java.at:482: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:482" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:482" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:486: grep 'super(\"Test Thread\"); if (true) throw new InterruptedException();' YYParser.java" at_fn_check_prepare_trace "java.at:486" ( $at_check_trace; grep 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:486" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_698 #AT_START_699 at_fn_group_banner 699 'java.at:497' \ "Java value, position, and location types" " " 29 at_xfail=no ( printf "%s\n" "699. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.value.type {java.awt.Color} %type start; %define api.location.type {MyLoc} %define api.position.type {MyPos} %code { class MyPos {} } %% start: END {$$ = $1;}; %% class MyPos {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:499: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:499" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:499: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:499" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:499: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:499" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:499: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:499" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:499: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:499" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:499: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:499" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:499: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:499" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:499" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:499" printf "%s\n" "java.at:499" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:499" { set +x printf "%s\n" "$at_srcdir/java.at:499: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:499" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:499" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:505: grep 'java.awt.Color' YYParser.java" at_fn_check_prepare_trace "java.at:505" ( $at_check_trace; grep 'java.awt.Color' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:505" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:506: \$EGREP -v ' */?\\*' YYParser.java | grep -w 'Position'" at_fn_check_prepare_notrace 'a shell pipeline' "java.at:506" ( $at_check_trace; $EGREP -v ' */?\*' YYParser.java | grep -w 'Position' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:506" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:507: \$EGREP -v ' */?\\*' YYParser.java | grep -w 'Location'" at_fn_check_prepare_notrace 'a shell pipeline' "java.at:507" ( $at_check_trace; $EGREP -v ' */?\*' YYParser.java | grep -w 'Location' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:507" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "Java" %locations %debug %define parse.error verbose %token-table %token END "end" %define api.value.type {java.awt.Color} %type start; %define api.location.type {MyLoc} %define api.position.type {MyPos} %code { class MyPos {} } %code lexer { java.awt.Color yylval; public java.awt.Color getLVal() { return yylval; } public MyPos getStartPos() { return null; } public MyPos getEndPos() { return null; } public void yyerror (MyLoc loc, String s) { System.err.println (loc + ": " + s); } public int yylex() { return EOF; } } %% start: END {$$ = $1;}; %% class MyPos {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "java.at:509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:509: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:509" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:509: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:509" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:509: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:509" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:509: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "java.at:509" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:509: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "java.at:509" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:509" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:509" printf "%s\n" "java.at:509" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:509" { set +x printf "%s\n" "$at_srcdir/java.at:509: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:509" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:509" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:517: grep 'java.awt.Color' YYParser.java" at_fn_check_prepare_trace "java.at:517" ( $at_check_trace; grep 'java.awt.Color' YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:517" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:518: \$EGREP -v ' */?\\*' YYParser.java | grep -w 'Position'" at_fn_check_prepare_notrace 'a shell pipeline' "java.at:518" ( $at_check_trace; $EGREP -v ' */?\*' YYParser.java | grep -w 'Position' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:518" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:519: \$EGREP -v ' */?\\*' YYParser.java | grep -w 'Location'" at_fn_check_prepare_notrace 'a shell pipeline' "java.at:519" ( $at_check_trace; $EGREP -v ' */?\*' YYParser.java | grep -w 'Location' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/java.at:519" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_699 #AT_START_700 at_fn_group_banner 700 'java.at:528' \ "Java syntax error handling without error token" " " 29 at_xfail=no ( printf "%s\n" "700. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "Java" %lex-param { String s } %code imports { import java.io.IOException; } %code lexer { String Input; int Position; public YYLexer(String s) { Input = s; Position = 0; } public void yyerror(String s) { System.err.println (s); } public Object getLVal() { return null; } public int yylex() throws IOException { if (Position >= Input.length ()) return EOF; else return Input.charAt (Position++); } } %code { public static void main(String args []) throws IOException { YYParser p = new YYParser(args[0]); p.parse(); } } %% input: 'a' 'a' ; _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/java.at:579: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "java.at:579" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:579" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:579: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml YYParser.y" "java.at:579" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:579" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/java.at:579: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:579" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:579" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/java.at:579: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "java.at:579" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:579" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/java.at:579: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "java.at:579" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:579" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/java.at:579: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret YYParser.y" at_fn_check_prepare_trace "java.at:579" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:579" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "java.at:580" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/java.at:580" printf "%s\n" "java.at:580" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/java.at:580" { set +x printf "%s\n" "$at_srcdir/java.at:580: \$SHELL ../../../javacomp.sh YYParser.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh YYParser.java" "java.at:580" ( $at_check_trace; $SHELL ../../../javacomp.sh YYParser.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/java.at:580" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:581: \$SHELL ../../../javaexec.sh YYParser aa" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh YYParser aa" "java.at:581" ( $at_check_trace; $SHELL ../../../javaexec.sh YYParser aa ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:581" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:582: \$SHELL ../../../javaexec.sh YYParser ab" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh YYParser ab" "java.at:582" ( $at_check_trace; $SHELL ../../../javaexec.sh YYParser ab ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:582" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/java.at:584: \$SHELL ../../../javaexec.sh YYParser ba" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh YYParser ba" "java.at:584" ( $at_check_trace; $SHELL ../../../javaexec.sh YYParser ba ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/java.at:584" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_700 #AT_START_701 at_fn_group_banner 701 'javapush.at:172' \ "Trivial Push Parser with api.push-pull verification" "" 30 at_xfail=no ( printf "%s\n" "701. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %language "Java" %define api.parser.class {YYParser} %define parse.error verbose %define parse.trace %code imports { import java.io.*; import java.util.*; } %% start: 'a' 'b' 'c' ; %% public class Main { static class YYerror implements YYParser.Lexer { public Object getLVal() {return null;} public int yylex () throws java.io.IOException { return 0; } public void yyerror (String msg) { System.err.println(msg); } } static YYParser parser = null; static YYerror yyerror = null; static int teststate = -1; static void setup() throws IOException { yyerror = new YYerror(); parser = new YYParser(yyerror); parser.setDebugLevel(1); teststate = -1; } static String[] teststatename = new String[]{"YYACCEPT","YYABORT","YYERROR","UNKNOWN","YYPUSH_MORE"}; static void check(int teststate, int expected, String msg) { System.err.println("teststate="+teststatename[teststate] +"; expected="+teststatename[expected]); if (teststate != expected) { System.err.println("unexpected state: "+msg); System.exit(1); } } static public void main (String[] args) throws IOException { setup(); teststate = parser.push_parse('a', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('a', null)"); setup(); teststate = parser.push_parse('a', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('a', null)"); teststate = parser.push_parse('b', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('b', null)"); teststate = parser.push_parse('c', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('c', null)"); teststate = parser.push_parse('\0', null); check(teststate,YYParser.YYACCEPT,"push_parse('\\0', null)"); /* Reuse the parser instance and cause a failure */ teststate = parser.push_parse('b', null); check(teststate,YYParser.YYABORT,"push_parse('b', null)"); System.exit(0); } } _ATEOF # Verify that the proper procedure(s) are generated for each case. if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/javapush.at:181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dapi.push-pull=pull -o Main.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "javapush.at:181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dapi.push-pull=pull -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:181" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=pull -o Main.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=pull -o Main.java input.y" "javapush.at:181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=pull -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:181" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/javapush.at:181: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:181" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:181" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/javapush.at:181: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "javapush.at:181" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:181" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/javapush.at:181: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:181" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:181" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/javapush.at:181: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=pull -o Main.java input.y" at_fn_check_prepare_trace "javapush.at:181" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=pull -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:181" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:182: grep -c '^.*public boolean parse().*\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^.*public boolean parse().*$' Main.java" "javapush.at:182" ( $at_check_trace; grep -c '^.*public boolean parse().*$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:182" $at_failed && at_fn_log_failure $at_traceon; } # If BISON_USE_PUSH_FOR_PULL is set, then we have one occurrence of # this function, otherwise it should not be there. { set +x printf "%s\n" "$at_srcdir/javapush.at:187: grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*$' Main.java" "javapush.at:187" ( $at_check_trace; grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "${BISON_USE_PUSH_FOR_PULL-0} " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:187" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/javapush.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dapi.push-pull=both -o Main.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "javapush.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dapi.push-pull=both -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=both -o Main.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=both -o Main.java input.y" "javapush.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=both -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:191" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/javapush.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:191" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/javapush.at:191: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "javapush.at:191" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:191" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/javapush.at:191: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:191" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:191" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/javapush.at:191: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=both -o Main.java input.y" at_fn_check_prepare_trace "javapush.at:191" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=both -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:191" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:192: grep -c '^.*public boolean parse().*\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^.*public boolean parse().*$' Main.java" "javapush.at:192" ( $at_check_trace; grep -c '^.*public boolean parse().*$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:192" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:195: grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*$' Main.java" "javapush.at:195" ( $at_check_trace; grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:195" $at_failed && at_fn_log_failure $at_traceon; } if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/javapush.at:199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dapi.push-pull=push -o Main.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "javapush.at:199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dapi.push-pull=push -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:199" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=push -o Main.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=push -o Main.java input.y" "javapush.at:199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=push -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:199" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/javapush.at:199: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:199" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:199" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/javapush.at:199: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "javapush.at:199" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:199" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/javapush.at:199: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:199" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:199" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/javapush.at:199: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=push -o Main.java input.y" at_fn_check_prepare_trace "javapush.at:199" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=push -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:199" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:200: grep -c '^.*public boolean parse().*\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^.*public boolean parse().*$' Main.java" "javapush.at:200" ( $at_check_trace; grep -c '^.*public boolean parse().*$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "0 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:200" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:203: grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*$' Main.java" "javapush.at:203" ( $at_check_trace; grep -c '^.*public int push_parse(int yylextoken, Object yylexval).*$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:203" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "javapush.at:207" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/javapush.at:207" printf "%s\n" "javapush.at:207" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/javapush.at:207" { set +x printf "%s\n" "$at_srcdir/javapush.at:207: \$SHELL ../../../javacomp.sh Main.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Main.java" "javapush.at:207" ( $at_check_trace; $SHELL ../../../javacomp.sh Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:208: \$SHELL ../../../javaexec.sh Main" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Main" "javapush.at:208" ( $at_check_trace; $SHELL ../../../javaexec.sh Main ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr captured; cp "$at_stderr" stderr at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:208" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_701 #AT_START_702 at_fn_group_banner 702 'javapush.at:217' \ "Trivial Push Parser with %initial-action" " " 30 at_xfail=no ( printf "%s\n" "702. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %language "Java" %initial-action { System.err.println("Initial action invoked"); } %define api.parser.class {YYParser} %define parse.error verbose %define parse.trace %code imports { import java.io.*; import java.util.*; } %% start: 'a' 'b' 'c' ; %% public class Main { static class YYerror implements YYParser.Lexer { public Object getLVal() {return null;} public int yylex () throws java.io.IOException { return 0; } public void yyerror (String msg) { System.err.println(msg); } } static YYParser parser = null; static YYerror yyerror = null; static int teststate = -1; static void setup() throws IOException { yyerror = new YYerror(); parser = new YYParser(yyerror); parser.setDebugLevel(1); teststate = -1; } static String[] teststatename = new String[]{"YYACCEPT","YYABORT","YYERROR","UNKNOWN","YYPUSH_MORE"}; static void check(int teststate, int expected, String msg) { System.err.println("teststate="+teststatename[teststate] +"; expected="+teststatename[expected]); if (teststate != expected) { System.err.println("unexpected state: "+msg); System.exit(1); } } static public void main (String[] args) throws IOException { setup(); teststate = parser.push_parse('a', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('a', null)"); teststate = parser.push_parse('b', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('b', null)"); teststate = parser.push_parse('c', null); check(teststate,YYParser.YYPUSH_MORE,"push_parse('c', null)"); teststate = parser.push_parse('\0', null); check(teststate,YYParser.YYACCEPT,"push_parse('\\0', null)"); System.exit(0); } } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/javapush.at:227: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Dapi.push-pull=push -o Main.java input.y" at_fn_check_prepare_notrace 'an embedded newline' "javapush.at:227" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Dapi.push-pull=push -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:227" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:227: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=push -o Main.java input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=push -o Main.java input.y" "javapush.at:227" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Dapi.push-pull=push -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:227" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/javapush.at:227: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:227" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:227" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/javapush.at:227: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "javapush.at:227" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:227" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/javapush.at:227: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "javapush.at:227" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:227" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/javapush.at:227: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=push -o Main.java input.y" at_fn_check_prepare_trace "javapush.at:227" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Dapi.push-pull=push -o Main.java input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:227" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:228: grep -c '^System.err.println(\"Initial action invoked\");\$' Main.java" at_fn_check_prepare_dynamic "grep -c '^System.err.println(\"Initial action invoked\");$' Main.java" "javapush.at:228" ( $at_check_trace; grep -c '^System.err.println("Initial action invoked");$' Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:228" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "javapush.at:230" >"$at_check_line_file" (test -z "$CONF_JAVAC") \ && at_fn_check_skip 77 "$at_srcdir/javapush.at:230" printf "%s\n" "javapush.at:230" >"$at_check_line_file" (test -z "$CONF_JAVA") \ && at_fn_check_skip 77 "$at_srcdir/javapush.at:230" { set +x printf "%s\n" "$at_srcdir/javapush.at:230: \$SHELL ../../../javacomp.sh Main.java" at_fn_check_prepare_dynamic "$SHELL ../../../javacomp.sh Main.java" "javapush.at:230" ( $at_check_trace; $SHELL ../../../javacomp.sh Main.java ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/javapush.at:231: \$SHELL ../../../javaexec.sh Main" at_fn_check_prepare_dynamic " $SHELL ../../../javaexec.sh Main" "javapush.at:231" ( $at_check_trace; $SHELL ../../../javaexec.sh Main ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr captured; cp "$at_stderr" stderr at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/javapush.at:231" $at_failed && at_fn_log_failure $at_traceon; } # Verify that initial action is called exactly once. { set +x printf "%s\n" "$at_srcdir/javapush.at:233: grep -c '^Initial action invoked\$' stderr" at_fn_check_prepare_dynamic "grep -c '^Initial action invoked$' stderr" "javapush.at:233" ( $at_check_trace; grep -c '^Initial action invoked$' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/javapush.at:233" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_702 #AT_START_703 at_fn_group_banner 703 'd.at:103' \ "D parser class extends and implements" " " 31 at_xfail=no ( printf "%s\n" "703. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %% start: END {}; %% void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:106: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:106" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:106: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:106" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:106: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:106" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:106: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:106" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:106: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:106" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:106: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:106" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:106: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:106" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:106" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:106" { set +x printf "%s\n" "$at_srcdir/d.at:106: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:106" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:106" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:107: grep -c '^class YYParser\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^class YYParser$' YYParser.d" "d.at:107" ( $at_check_trace; grep -c '^class YYParser$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:107" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %define api.parser.extends {BaseClass} %% start: END {}; %% class BaseClass {} void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:109: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:109" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:109: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:109" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:109: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:109" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:109: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:109" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:109: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:109" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:109: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:109" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:109: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:109" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:109" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:109" { set +x printf "%s\n" "$at_srcdir/d.at:109: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:109" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:109" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:110: grep -c '^class YYParser : BaseClass\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^class YYParser : BaseClass$' YYParser.d" "d.at:110" ( $at_check_trace; grep -c '^class YYParser : BaseClass$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:110" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %define api.parser.extends {Interface} %% start: END {}; %% interface Interface {} void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:112: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:112" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:112: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:112" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:112: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:112" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:112: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:112" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:112: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:112" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:112: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:112" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:112: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:112" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:112" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:112" { set +x printf "%s\n" "$at_srcdir/d.at:112: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:112" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:112" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:113: grep -c '^class YYParser : Interface\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^class YYParser : Interface$' YYParser.d" "d.at:113" ( $at_check_trace; grep -c '^class YYParser : Interface$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:113" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %define api.parser.extends {BaseClass} %define api.parser.implements {Interface} %% start: END {}; %% class BaseClass {} interface Interface {} void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:115: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:115" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:115: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:115" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:115: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:115" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:115: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:115" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:115: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:115" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:115: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:115" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:115: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:115" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:115" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:115" { set +x printf "%s\n" "$at_srcdir/d.at:115: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:115" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:115" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:121: grep -c '^class YYParser : BaseClass, Interface\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^class YYParser : BaseClass, Interface$' YYParser.d" "d.at:121" ( $at_check_trace; grep -c '^class YYParser : BaseClass, Interface$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:121" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %define api.parser.extends {BaseClass} %define api.parser.implements {Interface1, Interface2} %% start: END {}; %% class BaseClass {} interface Interface1 {} interface Interface2 {} void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:123: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:123" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:123: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:123" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:123: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:123" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:123: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:123" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:123: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:123" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:123: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:123" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:123: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:123" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:123" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:123" { set +x printf "%s\n" "$at_srcdir/d.at:123: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:123" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:123" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:130: grep -c '^class YYParser : BaseClass, Interface1, Interface2\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^class YYParser : BaseClass, Interface1, Interface2$' YYParser.d" "d.at:130" ( $at_check_trace; grep -c '^class YYParser : BaseClass, Interface1, Interface2$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:130" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_703 #AT_START_704 at_fn_group_banner 704 'd.at:138' \ "D parser class api.token.raw true by default" " " 31 at_xfail=no ( printf "%s\n" "704. $at_setup_line: testing $at_desc ..." $at_traceon cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %define api.token.raw true %union { int ival; } %% start: END {}; %% import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } void yyerror(string s) {} Symbol yylex() { return Symbol(TokenKind.END); } } void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:141: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:141" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:141: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:141" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:141: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:141" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:141: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:141" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:141: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:141" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:141: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:141" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:141: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:141" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:141" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:141" { set +x printf "%s\n" "$at_srcdir/d.at:141: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:141" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:141" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:144: grep -c '^ END = 3,\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^ END = 3,$' YYParser.d" "d.at:144" ( $at_check_trace; grep -c '^ END = 3,$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:144" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %define api.token.raw false %union { int ival; } %% start: END {}; %% import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } void yyerror(string s) {} Symbol yylex() { return Symbol(TokenKind.END); } } void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:146: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:146" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:146: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:146" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:146: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:146" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:146: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:146" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:146: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:146" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:146" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:146" { set +x printf "%s\n" "$at_srcdir/d.at:146: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:146" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:146" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:149: grep -c '^ END = 258,\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^ END = 258,$' YYParser.d" "d.at:149" ( $at_check_trace; grep -c '^ END = 258,$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:149" $at_failed && at_fn_log_failure $at_traceon; } cat >YYParser.y <<'_ATEOF' %language "D" %token END "end" %union { int ival; } %% start: END {}; %% import std.range.primitives; import std.stdio; auto calcLexer(R)(R range) if (isInputRange!R && is (ElementType!R : dchar)) { return new CalcLexer!R(range); } auto calcLexer (File f) { import std.algorithm : map, joiner; import std.utf : byDchar; return f.byChunk(1024) // avoid making a syscall roundtrip per char .map!(chunk => cast(char[]) chunk) // because byChunk returns ubyte[] .joiner // combine chunks into a single virtual range of char .calcLexer; // forward to other overload } class CalcLexer(R) : Lexer if (isInputRange!R && is (ElementType!R : dchar)) { R input; this(R r) { input = r; } void yyerror(string s) {} Symbol yylex() { return Symbol(TokenKind.END); } } void main() {} _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/d.at:151: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y" at_fn_check_prepare_notrace 'an embedded newline' "d.at:151" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:151: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y" "d.at:151" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/d.at:151: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:151" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/d.at:151: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "d.at:151" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/d.at:151: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "d.at:151" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/d.at:151: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y" at_fn_check_prepare_trace "d.at:151" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -Wno-deprecated YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:151: grep '[mb]4_' YYParser.y" at_fn_check_prepare_trace "d.at:151" ( $at_check_trace; grep '[mb]4_' YYParser.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; cat "$at_stdout" at_fn_check_status 1 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "d.at:151" >"$at_check_line_file" (! $BISON_DC_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/d.at:151" { set +x printf "%s\n" "$at_srcdir/d.at:151: \$DC \$DCFLAGS -ofYYParser YYParser.d" at_fn_check_prepare_dynamic "$DC $DCFLAGS -ofYYParser YYParser.d" "d.at:151" ( $at_check_trace; $DC $DCFLAGS -ofYYParser YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/d.at:151" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/d.at:153: grep -c '^ END = 3,\$' YYParser.d" at_fn_check_prepare_dynamic "grep -c '^ END = 3,$' YYParser.d" "d.at:153" ( $at_check_trace; grep -c '^ END = 3,$' YYParser.d ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo >>"$at_stdout"; printf "%s\n" "1 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_skip $at_status "$at_srcdir/d.at:153" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_704 #AT_START_705 at_fn_group_banner 705 'cxx-type.at:409' \ "GLR: Resolve ambiguity, impure, no locations" " " 32 at_xfail=no ( printf "%s\n" "705. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %dprec 1 { $$ = $1; } | decl %dprec 2 | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (void) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:410" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:410" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:410" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:410" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:410" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:410" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:410: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:410" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:410" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:412: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:412" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) (T,x) (T,y,+(z,q)) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:412" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:412: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:412" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:412" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:412: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:412" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) (T,x) (T,y,+(z,q)) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:412" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:412: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:412" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:412" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_705 #AT_START_706 at_fn_group_banner 706 'cxx-type.at:415' \ "GLR: Resolve ambiguity, impure, locations" " " 32 at_xfail=no ( printf "%s\n" "706. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %locations %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; printf ("%d.%d-%d.%d: ", @2.first_line, @2.first_column, @2.last_line, @2.last_column); output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %dprec 1 { $$ = $1; } | decl %dprec 2 | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (void) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; yylloc.first_line = yylloc.last_line = lineNum; yylloc.first_column = colNum; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } yylloc.last_column = colNum; return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:416" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:416" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:416" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:416" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:416" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:416" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:416: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:416" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:416" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:417: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:417" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: (T,x) 15.0-15.14: (T,y,+(z,q)) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:417: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:417" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "17.5: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:417: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:417" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: (T,x) 15.0-15.14: (T,y,+(z,q)) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:417" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:417: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:417" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:417" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_706 #AT_START_707 at_fn_group_banner 707 'cxx-type.at:420' \ "GLR: Resolve ambiguity, pure, no locations" " " 32 at_xfail=no ( printf "%s\n" "707. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %define api.pure %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %dprec 1 { $$ = $1; } | decl %dprec 2 | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:421" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:421" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:421" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:421" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:421" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:421" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:421" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:421" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:421: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:421" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:421" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:423: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:423" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) (T,x) (T,y,+(z,q)) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:423" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:423: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:423" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:423" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:423: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:423" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) (T,x) (T,y,+(z,q)) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:423" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:423: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:423" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:423" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_707 #AT_START_708 at_fn_group_banner 708 'cxx-type.at:426' \ "GLR: Resolve ambiguity, pure, locations" " " 32 at_xfail=no ( printf "%s\n" "708. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %define api.pure %locations %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; printf ("%d.%d-%d.%d: ", @2.first_line, @2.first_column, @2.last_line, @2.last_column); output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %dprec 1 { $$ = $1; } | decl %dprec 2 | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; yylloc.first_line = yylloc.last_line = lineNum; yylloc.first_column = colNum; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } yylloc.last_column = colNum; return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:427" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:427" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:427" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:427" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:427" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:427" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:427" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:427" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:427: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:427" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:427" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:429: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:429" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: (T,x) 15.0-15.14: (T,y,+(z,q)) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:429" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:429: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:429" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "17.5: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:429" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:429: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:429" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: (T,x) 15.0-15.14: (T,y,+(z,q)) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:429" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:429: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:429" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:429" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_708 #AT_START_709 at_fn_group_banner 709 'cxx-type.at:432' \ "GLR: Merge conflicting parses, impure, no locations" "" 32 at_xfail=no ( printf "%s\n" "709. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %merge { $$ = $1; } | decl %merge | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (void) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1) { return new_nterm ("(%s,%s)", x0, x1, YY_NULLPTR); } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:433" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:433" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:433" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:433" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:433" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:433" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:433" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:433" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:433: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:433" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:433" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:435: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:435" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) ((T,x),(x,T)) ((T,y,+(z,q)),=((y,T),+(z,q))) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:435: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:435" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) ((T,x),(x,T)) ((T,y,+(z,q)),=((y,T),+(z,q))) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:435" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:435: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:435" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:435" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_709 #AT_START_710 at_fn_group_banner 710 'cxx-type.at:438' \ "GLR: Merge conflicting parses, impure, locations" "" 32 at_xfail=no ( printf "%s\n" "710. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %locations %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; printf ("%d.%d-%d.%d: ", @2.first_line, @2.first_column, @2.last_line, @2.last_column); output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %merge { $$ = $1; } | decl %merge | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (void) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; yylloc.first_line = yylloc.last_line = lineNum; yylloc.first_column = colNum; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } yylloc.last_column = colNum; return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1) { return new_nterm ("(%s,%s)", x0, x1, YY_NULLPTR); } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:439" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:439" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:439" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:439" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:439" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:439" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:439" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:439" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:439: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:439" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:439" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:441: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:441" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: ((T,x),(x,T)) 15.0-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "17.5: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:441: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:441" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: ((T,x),(x,T)) 15.0-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:441: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:441" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:441" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_710 #AT_START_711 at_fn_group_banner 711 'cxx-type.at:444' \ "GLR: Merge conflicting parses, pure, no locations" "" 32 at_xfail=no ( printf "%s\n" "711. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %define api.pure %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (YYSTYPE *lvalp); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %merge { $$ = $1; } | decl %merge | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1) { return new_nterm ("(%s,%s)", x0, x1, YY_NULLPTR); } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:445" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:445" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:445" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:445" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:445" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:445: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:445" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:447: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:447" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) ((T,x),(x,T)) ((T,y,+(z,q)),=((y,T),+(z,q))) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:447" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:447: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:447" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:447" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:447: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:447" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) ((T,x),(x,T)) ((T,y,+(z,q)),=((y,T),+(z,q))) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:447" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:447: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:447" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:447" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_711 #AT_START_712 at_fn_group_banner 712 'cxx-type.at:449' \ "GLR: Merge conflicting parses, pure, locations" " " 32 at_xfail=no ( printf "%s\n" "712. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %define api.pure %locations %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; printf ("%d.%d-%d.%d: ", @2.first_line, @2.first_column, @2.last_line, @2.last_column); output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %merge { $$ = $1; } | decl %merge | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; yylloc.first_line = yylloc.last_line = lineNum; yylloc.first_column = colNum; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } yylloc.last_column = colNum; return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1) { return new_nterm ("(%s,%s)", x0, x1, YY_NULLPTR); } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:450" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:450" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:450" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:450" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:450" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:450" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:450" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:450" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:450: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:450" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:450" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:452: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:452" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: ((T,x),(x,T)) 15.0-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:452" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:452: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:452" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "17.5: syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:452" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:452: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:452" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "3.0-3.6: +(z,q) 5.0-5.4: (T,x) 7.0-7.8: (T,x,y) 9.0-9.6: =(x,y) 11.0-11.10: +((x,T),y) 13.0-13.6: ((T,x),(x,T)) 15.0-15.14: ((T,y,+(z,q)),=((y,T),+(z,q))) 17.0-17.16: 19.0-19.6: +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:452" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:452: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:452" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:452" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_712 #AT_START_713 at_fn_group_banner 713 'cxx-type.at:455' \ "GLR: Verbose messages, resolve ambiguity, impure, no locations" "" 32 at_xfail=no ( printf "%s\n" "713. $at_setup_line: testing $at_desc ..." $at_traceon cat >types.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Simplified C++ Type and Expression Grammar. */ %define parse.trace %define parse.error verbose %code requires { #include union Node { struct { int isNterm; int parents; } nodeInfo; struct { int isNterm; /* 1 */ int parents; char const *form; union Node *children[3]; } nterm; struct { int isNterm; /* 0 */ int parents; char *text; } term; }; typedef union Node Node; #define YYSTYPE Node * } %code { static Node *new_nterm (char const *, Node *, Node *, Node *); static Node *new_term (char *); static void free_node (Node *); static char *node_to_string (Node *); static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1); #define YYINITDEPTH 10 #define YYSTACKEXPANDABLE 1 #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %token TYPENAME ID %right '=' %left '+' %glr-parser %destructor { free_node ($$); } stmt expr decl declarator TYPENAME ID %% prog : | prog stmt { char *output; output = node_to_string ($2); printf ("%s\n", output); free (output); free_node ($2); } ; stmt : expr ';' %merge { $$ = $1; } | decl %merge | error ';' { $$ = new_nterm ("", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); } | '@' { YYACCEPT; } ; expr : ID | TYPENAME '(' expr ')' { $$ = new_nterm ("(%s,%s)", $3, $1, YY_NULLPTR); } | expr '+' expr { $$ = new_nterm ("+(%s,%s)", $1, $3, YY_NULLPTR); } | expr '=' expr { $$ = new_nterm ("=(%s,%s)", $1, $3, YY_NULLPTR); } ; decl : TYPENAME declarator ';' { $$ = new_nterm ("(%s,%s)", $1, $2, YY_NULLPTR); } | TYPENAME declarator '=' expr ';' { $$ = new_nterm ("(%s,%s,%s)", $1, $2, $4); } ; declarator : ID | '(' declarator ')' { $$ = $2; } ; %% #include #include #include #include #include int main (int argc, char **argv) { if (getenv ("YYDEBUG")) yydebug = 1; for (int i = 1; i < argc; ++i) // Enable parse traces on option -p. if (strcmp (argv[i], "-p") == 0) yydebug = 1; else { if (!freopen (argv[i], "r", stdin)) return 3; int status = yyparse (); if (!status) return status; } return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (void) { static int lineNum = 1; static int colNum = 0; #if YYPURE # undef yylloc # define yylloc (*llocp) # undef yylval # define yylval (*lvalp) #endif while (1) { int c; assert (!feof (stdin)); c = getchar (); switch (c) { case EOF: return 0; case '\t': colNum = (colNum + 7) & ~7; break; case ' ': case '\f': colNum += 1; break; case '\n': lineNum += 1; colNum = 0; break; default: { int tok; if (isalpha (c)) { char buffer[256]; unsigned i = 0; do { buffer[i++] = YY_CAST (char, c); colNum += 1; assert (i != sizeof buffer - 1); c = getchar (); } while (isalnum (c) || c == '_'); ungetc (c, stdin); buffer[i++] = 0; tok = isupper (YY_CAST (unsigned char, buffer[0])) ? TYPENAME : ID; yylval = new_term (strcpy (YY_CAST (char *, malloc (i)), buffer)); } else { colNum += 1; tok = c; yylval = YY_NULLPTR; } return tok; } } } } static Node * new_nterm (char const *form, Node *child0, Node *child1, Node *child2) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->nterm.isNterm = 1; node->nterm.parents = 0; node->nterm.form = form; node->nterm.children[0] = child0; if (child0) child0->nodeInfo.parents += 1; node->nterm.children[1] = child1; if (child1) child1->nodeInfo.parents += 1; node->nterm.children[2] = child2; if (child2) child2->nodeInfo.parents += 1; return node; } static Node * new_term (char *text) { Node *node = YY_CAST (Node *, malloc (sizeof (Node))); node->term.isNterm = 0; node->term.parents = 0; node->term.text = text; return node; } static void free_node (Node *node) { if (!node) return; node->nodeInfo.parents -= 1; /* Free only if 0 (last parent) or -1 (no parents). */ if (node->nodeInfo.parents > 0) return; if (node->nodeInfo.isNterm == 1) { free_node (node->nterm.children[0]); free_node (node->nterm.children[1]); free_node (node->nterm.children[2]); } else free (node->term.text); free (node); } static char * node_to_string (Node *node) { char *res; if (!node) { res = YY_CAST (char *, malloc (1)); res[0] = 0; } else if (node->nodeInfo.isNterm == 1) { char *child0 = node_to_string (node->nterm.children[0]); char *child1 = node_to_string (node->nterm.children[1]); char *child2 = node_to_string (node->nterm.children[2]); res = YY_CAST (char *, malloc (strlen (node->nterm.form) + strlen (child0) + strlen (child1) + strlen (child2) + 1)); sprintf (res, node->nterm.form, child0, child1, child2); free (child2); free (child1); free (child0); } else res = strdup (node->term.text); return res; } static YYSTYPE stmt_merge (YYSTYPE x0, YYSTYPE x1) { return new_nterm ("(%s,%s)", x0, x1, YY_NULLPTR); } _ATEOF cat >test-input <<'_ATEOF' z + q; T x; T x = y; x = y; T (x) + y; T (x); T (y) = z + q; T (y y) = z + q; z + q; @ This is total garbage, but it should be ignored. _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o types.c types.y" at_fn_check_prepare_notrace 'an embedded newline' "cxx-type.at:456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y" "cxx-type.at:456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:456" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "cxx-type.at:456" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "cxx-type.at:456" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y" at_fn_check_prepare_trace "cxx-type.at:456" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o types.c types.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "cxx-type.at:456" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/cxx-type.at:456" { set +x printf "%s\n" "$at_srcdir/cxx-type.at:456: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o types types.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS" "cxx-type.at:456" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o types types.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:456" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:458: \$PREPARSER ./types test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types test-input" "cxx-type.at:458" ( $at_check_trace; $PREPARSER ./types test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) ((T,x),(x,T)) ((T,y,+(z,q)),=((y,T),+(z,q))) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected ID, expecting '=' or '+' or ')' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:458: \$PREPARSER ./types -p test-input" at_fn_check_prepare_dynamic " $PREPARSER ./types -p test-input" "cxx-type.at:458" ( $at_check_trace; $PREPARSER ./types -p test-input ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "+(z,q) (T,x) (T,x,y) =(x,y) +((x,T),y) ((T,x),(x,T)) ((T,y,+(z,q)),=((y,T),+(z,q))) +(z,q) " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:458" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/cxx-type.at:458: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "cxx-type.at:458" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/cxx-type.at:458" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_713 #AT_START_714 at_fn_group_banner 714 'glr-regression.at:205' \ "Badly Collapsed GLR States: glr.c" " " 33 at_xfail=no ( printf "%s\n" "714. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr1.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper state compression */ /* Reported by Scott McPeak */ %define api.value.type {int} %code { #include static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.assert %define parse.trace %glr-parser %expect 1 %skeleton "glr.c" /* -------- productions ------ */ %% StartSymbol: E { $$=0; } %merge ; E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge | 'B' { $$=2; printf("E -> 'B'\n"); } %merge ; /* ---------- C code ----------- */ %% static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1) { (void) x0; (void) x1; printf ("\n"); return 0; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } const char *input = YY_NULLPTR; int yylex (void) { return *input++; } int main (int argc, const char* argv[]) { assert (argc == 2); (void) argc; input = argv[1]; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o glr-regr1.c glr-regr1.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o glr-regr1.c glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.c glr-regr1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.c glr-regr1.y" "glr-regression.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.c glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:205" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:205" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:205" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o glr-regr1.c glr-regr1.y" at_fn_check_prepare_trace "glr-regression.at:205" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o glr-regr1.c glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:205" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:205" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr1 glr-regr1.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr1 glr-regr1.c $LIBS" "glr-regression.at:205" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr1 glr-regr1.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: \$PREPARSER ./glr-regr1 BPBPB" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr1 BPBPB" "glr-regression.at:205" ( $at_check_trace; $PREPARSER ./glr-regr1 BPBPB ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "E -> 'B' E -> 'B' E -> E 'P' E E -> 'B' E -> E 'P' E E -> 'B' E -> E 'P' E E -> E 'P' E " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:205: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:205" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:205" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_714 #AT_START_715 at_fn_group_banner 715 'glr-regression.at:206' \ "Badly Collapsed GLR States: glr.cc" " " 33 at_xfail=no ( printf "%s\n" "715. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr1.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper state compression */ /* Reported by Scott McPeak */ %define api.value.type {int} %code { #include static yy::parser::value_type exprMerge (yy::parser::value_type x0, yy::parser::value_type x1); static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %glr-parser %expect 1 %skeleton "glr.cc" /* -------- productions ------ */ %% StartSymbol: E { $$=0; } %merge ; E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge | 'B' { $$=2; printf("E -> 'B'\n"); } %merge ; /* ---------- C code ----------- */ %% static yy::parser::value_type exprMerge (yy::parser::value_type x0, yy::parser::value_type x1) { (void) x0; (void) x1; printf ("\n"); return 0; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } const char *input = YY_NULLPTR; int yylex (yy::parser::value_type *lvalp) { (void) lvalp; return *input++; } int main (int argc, const char* argv[]) { assert (argc == 2); (void) argc; input = argv[1]; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o glr-regr1.cc glr-regr1.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:206" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o glr-regr1.cc glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.cc glr-regr1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.cc glr-regr1.y" "glr-regression.at:206" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.cc glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:206" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:206" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:206" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o glr-regr1.cc glr-regr1.y" at_fn_check_prepare_trace "glr-regression.at:206" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o glr-regr1.cc glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:206" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:206" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr1 glr-regr1.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr1 glr-regr1.cc $LIBS" "glr-regression.at:206" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr1 glr-regr1.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: \$PREPARSER ./glr-regr1 BPBPB" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr1 BPBPB" "glr-regression.at:206" ( $at_check_trace; $PREPARSER ./glr-regr1 BPBPB ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "E -> 'B' E -> 'B' E -> E 'P' E E -> 'B' E -> E 'P' E E -> 'B' E -> E 'P' E E -> E 'P' E " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:206: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:206" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:206" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_715 #AT_START_716 at_fn_group_banner 716 'glr-regression.at:207' \ "Badly Collapsed GLR States: glr2.cc" " " 33 at_xfail=no ( printf "%s\n" "716. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr1.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper state compression */ /* Reported by Scott McPeak */ %define api.value.type {int} %code { #include static yy::parser::value_type exprMerge (yy::parser::value_type x0, yy::parser::value_type x1); static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %glr-parser %expect 1 %skeleton "glr2.cc" /* -------- productions ------ */ %% StartSymbol: E { $$=0; } %merge ; E: E 'P' E { $$=1; printf("E -> E 'P' E\n"); } %merge | 'B' { $$=2; printf("E -> 'B'\n"); } %merge ; /* ---------- C code ----------- */ %% static yy::parser::value_type exprMerge (yy::parser::value_type x0, yy::parser::value_type x1) { (void) x0; (void) x1; printf ("\n"); return 0; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } const char *input = YY_NULLPTR; int yylex (yy::parser::value_type *lvalp) { (void) lvalp; return *input++; } int main (int argc, const char* argv[]) { assert (argc == 2); (void) argc; input = argv[1]; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o glr-regr1.cc glr-regr1.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:207" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o glr-regr1.cc glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.cc glr-regr1.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.cc glr-regr1.y" "glr-regression.at:207" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o glr-regr1.cc glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:207" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:207" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:207" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o glr-regr1.cc glr-regr1.y" at_fn_check_prepare_trace "glr-regression.at:207" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o glr-regr1.cc glr-regr1.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:207" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:207" printf "%s\n" "glr-regression.at:207" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:207" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr1 glr-regr1.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr1 glr-regr1.cc $LIBS" "glr-regression.at:207" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr1 glr-regr1.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: \$PREPARSER ./glr-regr1 BPBPB" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr1 BPBPB" "glr-regression.at:207" ( $at_check_trace; $PREPARSER ./glr-regr1 BPBPB ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "E -> 'B' E -> 'B' E -> E 'P' E E -> 'B' E -> E 'P' E E -> 'B' E -> E 'P' E E -> E 'P' E " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:207: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:207" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:207" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_716 #AT_START_717 at_fn_group_banner 717 'glr-regression.at:354' \ "Improper handling of embedded actions and dollar(-N) in GLR parsers: glr.c" "" 33 at_xfail=no ( printf "%s\n" "717. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr2a.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper handling of embedded actions and $-N */ /* Reported by S. Eken */ %define api.value.type {char *} %code { #include #include #include #include #include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.assert %define parse.trace %glr-parser %expect 2 %skeleton "glr.c" %% command: 's' var 't' { printf ("Variable: '%s'\n", $2); } 'v' 'x' 'q' { free ($2); } | 's' var_list 't' 'e' { printf ("Varlist: '%s'\n", $2); free ($2); } | 's' var 't' var_printer 'x' { free ($2); } ; var: 'V' { $$ = $1; } ; var_list: var { $$ = $1; } | var ',' var_list { char *s = YY_CAST (char *, realloc ($1, strlen ($1) + 1 + strlen ($3) + 1)); strcat (s, ","); strcat (s, $3); free ($3); $$ = s; } ; var_printer: 'v' { printf ("Variable: '%s'\n", $-1); } %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } FILE *input; int yylex (void) { char buf[50]; assert (!feof (stdin)); switch (fscanf (input, " %1[a-z,]", buf)) { case 1: return buf[0]; case EOF: return 0; default: if (fscanf (input, "%49s", buf) != 1) return 0; else { char *s; assert (strlen (buf) < sizeof buf - 1); s = YY_CAST (char *, malloc (strlen (buf) + 1)); strcpy (s, buf); (yylval) = s; return 'V'; } break; } } int main (int argc, char **argv) { int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; if (getenv ("YYDEBUG")) yydebug = 1; res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr2a.c glr-regr2a.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr2a.c glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.c glr-regr2a.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.c glr-regr2a.y" "glr-regression.at:354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.c glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:354" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:354" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:354" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr2a.c glr-regr2a.y" at_fn_check_prepare_trace "glr-regression.at:354" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr2a.c glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:354" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:354" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr2a glr-regr2a.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.c $LIBS" "glr-regression.at:354" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } cat >input1.txt <<'_ATEOF' s VARIABLE_1 t v x q _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: \$PREPARSER ./glr-regr2a input1.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input1.txt" "glr-regression.at:354" ( $at_check_trace; $PREPARSER ./glr-regr2a input1.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Variable: 'VARIABLE_1' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } cat >input2.txt <<'_ATEOF' s VARIABLE_1 , ANOTHER_VARIABLE_2 t e _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: \$PREPARSER ./glr-regr2a input2.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input2.txt" "glr-regression.at:354" ( $at_check_trace; $PREPARSER ./glr-regr2a input2.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } cat >input3.txt <<'_ATEOF' s VARIABLE_3 t v x _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: \$PREPARSER ./glr-regr2a input3.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input3.txt" "glr-regression.at:354" ( $at_check_trace; $PREPARSER ./glr-regr2a input3.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Variable: 'VARIABLE_3' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:354: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:354" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:354" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_717 #AT_START_718 at_fn_group_banner 718 'glr-regression.at:355' \ "Improper handling of embedded actions and dollar(-N) in GLR parsers: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "718. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr2a.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper handling of embedded actions and $-N */ /* Reported by S. Eken */ %define api.value.type {char *} %code { #include #include #include #include #include static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %glr-parser %expect 2 %skeleton "glr.cc" %% command: 's' var 't' { printf ("Variable: '%s'\n", $2); } 'v' 'x' 'q' { free ($2); } | 's' var_list 't' 'e' { printf ("Varlist: '%s'\n", $2); free ($2); } | 's' var 't' var_printer 'x' { free ($2); } ; var: 'V' { $$ = $1; } ; var_list: var { $$ = $1; } | var ',' var_list { char *s = YY_CAST (char *, realloc ($1, strlen ($1) + 1 + strlen ($3) + 1)); strcat (s, ","); strcat (s, $3); free ($3); $$ = s; } ; var_printer: 'v' { printf ("Variable: '%s'\n", $-1); } %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } FILE *input; int yylex (yy::parser::value_type *lvalp) { char buf[50]; (void) lvalp; assert (!feof (stdin)); switch (fscanf (input, " %1[a-z,]", buf)) { case 1: return buf[0]; case EOF: return 0; default: if (fscanf (input, "%49s", buf) != 1) return 0; else { char *s; assert (strlen (buf) < sizeof buf - 1); s = YY_CAST (char *, malloc (strlen (buf) + 1)); strcpy (s, buf); (*lvalp) = s; return 'V'; } break; } } static int yyparse () { yy::parser p; return p.parse (); } int main (int argc, char **argv) { int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; if (getenv ("YYDEBUG")) yydebug = 1; res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr2a.cc glr-regr2a.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr2a.cc glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.cc glr-regr2a.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.cc glr-regr2a.y" "glr-regression.at:355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.cc glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:355" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:355" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:355" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr2a.cc glr-regr2a.y" at_fn_check_prepare_trace "glr-regression.at:355" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr2a.cc glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:355" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:355" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr2a glr-regr2a.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.cc $LIBS" "glr-regression.at:355" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } cat >input1.txt <<'_ATEOF' s VARIABLE_1 t v x q _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: \$PREPARSER ./glr-regr2a input1.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input1.txt" "glr-regression.at:355" ( $at_check_trace; $PREPARSER ./glr-regr2a input1.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Variable: 'VARIABLE_1' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } cat >input2.txt <<'_ATEOF' s VARIABLE_1 , ANOTHER_VARIABLE_2 t e _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: \$PREPARSER ./glr-regr2a input2.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input2.txt" "glr-regression.at:355" ( $at_check_trace; $PREPARSER ./glr-regr2a input2.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } cat >input3.txt <<'_ATEOF' s VARIABLE_3 t v x _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: \$PREPARSER ./glr-regr2a input3.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input3.txt" "glr-regression.at:355" ( $at_check_trace; $PREPARSER ./glr-regr2a input3.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Variable: 'VARIABLE_3' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:355: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:355" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:355" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_718 #AT_START_719 at_fn_group_banner 719 'glr-regression.at:356' \ "Improper handling of embedded actions and dollar(-N) in GLR parsers: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "719. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr2a.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper handling of embedded actions and $-N */ /* Reported by S. Eken */ %define api.value.type {char *} %code { #include #include #include #include #include static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %glr-parser %expect 2 %skeleton "glr2.cc" %% command: 's' var 't' { printf ("Variable: '%s'\n", $2); } 'v' 'x' 'q' { free ($2); } | 's' var_list 't' 'e' { printf ("Varlist: '%s'\n", $2); free ($2); } | 's' var 't' var_printer 'x' { free ($2); } ; var: 'V' { $$ = $1; } ; var_list: var { $$ = $1; } | var ',' var_list { char *s = YY_CAST (char *, realloc ($1, strlen ($1) + 1 + strlen ($3) + 1)); strcat (s, ","); strcat (s, $3); free ($3); $$ = s; } ; var_printer: 'v' { printf ("Variable: '%s'\n", $-1); } %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } FILE *input; int yylex (yy::parser::value_type *lvalp) { char buf[50]; (void) lvalp; assert (!feof (stdin)); switch (fscanf (input, " %1[a-z,]", buf)) { case 1: return buf[0]; case EOF: return 0; default: if (fscanf (input, "%49s", buf) != 1) return 0; else { char *s; assert (strlen (buf) < sizeof buf - 1); s = YY_CAST (char *, malloc (strlen (buf) + 1)); strcpy (s, buf); (*lvalp) = s; return 'V'; } break; } } static int yyparse () { yy::parser p; return p.parse (); } int main (int argc, char **argv) { int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; if (getenv ("YYDEBUG")) yydebug = 1; res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr2a.cc glr-regr2a.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:356" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr2a.cc glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.cc glr-regr2a.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.cc glr-regr2a.y" "glr-regression.at:356" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr2a.cc glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:356" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:356" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:356" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr2a.cc glr-regr2a.y" at_fn_check_prepare_trace "glr-regression.at:356" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr2a.cc glr-regr2a.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:356" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:356" printf "%s\n" "glr-regression.at:356" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:356" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr2a glr-regr2a.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.cc $LIBS" "glr-regression.at:356" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr2a glr-regr2a.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } cat >input1.txt <<'_ATEOF' s VARIABLE_1 t v x q _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: \$PREPARSER ./glr-regr2a input1.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input1.txt" "glr-regression.at:356" ( $at_check_trace; $PREPARSER ./glr-regr2a input1.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Variable: 'VARIABLE_1' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:356" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } cat >input2.txt <<'_ATEOF' s VARIABLE_1 , ANOTHER_VARIABLE_2 t e _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: \$PREPARSER ./glr-regr2a input2.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input2.txt" "glr-regression.at:356" ( $at_check_trace; $PREPARSER ./glr-regr2a input2.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Varlist: 'VARIABLE_1,ANOTHER_VARIABLE_2' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:356" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } cat >input3.txt <<'_ATEOF' s VARIABLE_3 t v x _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: \$PREPARSER ./glr-regr2a input3.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr2a input3.txt" "glr-regression.at:356" ( $at_check_trace; $PREPARSER ./glr-regr2a input3.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Variable: 'VARIABLE_3' " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:356: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:356" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:356" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_719 #AT_START_720 at_fn_group_banner 720 'glr-regression.at:488' \ "Improper merging of GLR delayed action sets: glr.c" "" 33 at_xfail=no ( printf "%s\n" "720. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr3.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper merging of GLR delayed action sets. */ /* Reported by M. Rosien */ %code { #include #include static int MergeRule (int x0, int x1); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define RULE(x) (1 << (x)) } %define parse.assert %define parse.trace %glr-parser %expect 1 %expect-rr 2 %skeleton "glr.c" %token BAD_CHAR %token P1 P2 T1 T2 T3 T4 O1 O2 %% S : P1 T4 O2 NT6 P2 { printf ("Result: %x\n", $4); } ; NT1 : P1 T1 O1 T2 P2 { $$ = RULE(2); } %merge ; NT2 : NT1 { $$ = RULE(3); } %merge | P1 NT1 O1 T3 P2 { $$ = RULE(4); } %merge ; NT3 : T3 { $$ = RULE(5); } %merge | P1 NT1 O1 T3 P2 { $$ = RULE(6); } %merge ; NT4 : NT3 { $$ = RULE(7); } %merge | NT2 { $$ = RULE(8); } %merge | P1 NT2 O1 NT3 P2 { $$ = RULE(9); } %merge ; NT5 : NT4 { $$ = RULE(10); } %merge ; NT6 : P1 NT1 O1 T3 P2 { $$ = RULE(11) | $2; } %merge | NT5 { $$ = RULE(12) | $1; } %merge ; %% static int MergeRule (int x0, int x1) { return x0 | x1; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } FILE *input = YY_NULLPTR; int P[] = { P1, P2 }; int O[] = { O1, O2 }; int T[] = { T1, T2, T3, T4 }; int yylex (void) { char inp[3]; assert (!feof (stdin)); if (fscanf (input, "%2s", inp) == EOF) return 0; switch (inp[0]) { case 'p': return P[inp[1] - '1']; case 't': return T[inp[1] - '1']; case 'o': return O[inp[1] - '1']; } return BAD_CHAR; } int main (int argc, char* argv[]) { int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; if (getenv ("YYDEBUG")) yydebug = 1; res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr3.c glr-regr3.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:488" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr3.c glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.c glr-regr3.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.c glr-regr3.y" "glr-regression.at:488" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.c glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:488" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:488" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:488" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr3.c glr-regr3.y" at_fn_check_prepare_trace "glr-regression.at:488" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr3.c glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:488" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:488" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr3 glr-regr3.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr3 glr-regr3.c $LIBS" "glr-regression.at:488" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr3 glr-regr3.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } cat >input.txt <<'_ATEOF' p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: \$PREPARSER ./glr-regr3 input.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr3 input.txt" "glr-regression.at:488" ( $at_check_trace; $PREPARSER ./glr-regr3 input.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Result: 1c04 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:488: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:488" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:488" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_720 #AT_START_721 at_fn_group_banner 721 'glr-regression.at:489' \ "Improper merging of GLR delayed action sets: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "721. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr3.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper merging of GLR delayed action sets. */ /* Reported by M. Rosien */ %code { #include #include static int MergeRule (int x0, int x1); static int yylex (yy::parser::value_type *lvalp); #define RULE(x) (1 << (x)) } %define parse.assert %define parse.trace %glr-parser %expect 1 %expect-rr 2 %skeleton "glr.cc" %token BAD_CHAR %token P1 P2 T1 T2 T3 T4 O1 O2 %% S : P1 T4 O2 NT6 P2 { printf ("Result: %x\n", $4); } ; NT1 : P1 T1 O1 T2 P2 { $$ = RULE(2); } %merge ; NT2 : NT1 { $$ = RULE(3); } %merge | P1 NT1 O1 T3 P2 { $$ = RULE(4); } %merge ; NT3 : T3 { $$ = RULE(5); } %merge | P1 NT1 O1 T3 P2 { $$ = RULE(6); } %merge ; NT4 : NT3 { $$ = RULE(7); } %merge | NT2 { $$ = RULE(8); } %merge | P1 NT2 O1 NT3 P2 { $$ = RULE(9); } %merge ; NT5 : NT4 { $$ = RULE(10); } %merge ; NT6 : P1 NT1 O1 T3 P2 { $$ = RULE(11) | $2; } %merge | NT5 { $$ = RULE(12) | $1; } %merge ; %% static int MergeRule (int x0, int x1) { return x0 | x1; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } FILE *input = YY_NULLPTR; int P[] = { yy::parser::token::P1, yy::parser::token::P2 }; int O[] = { yy::parser::token::O1, yy::parser::token::O2 }; int T[] = { yy::parser::token::T1, yy::parser::token::T2, yy::parser::token::T3, yy::parser::token::T4 }; int yylex (yy::parser::value_type *lvalp) { char inp[3]; (void) lvalp; assert (!feof (stdin)); if (fscanf (input, "%2s", inp) == EOF) return 0; switch (inp[0]) { case 'p': return P[inp[1] - '1']; case 't': return T[inp[1] - '1']; case 'o': return O[inp[1] - '1']; } return yy::parser::token::BAD_CHAR; } static int yyparse () { yy::parser p; return p.parse (); } int main (int argc, char* argv[]) { int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; if (getenv ("YYDEBUG")) yydebug = 1; res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr3.cc glr-regr3.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr3.cc glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.cc glr-regr3.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.cc glr-regr3.y" "glr-regression.at:489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.cc glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:489" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:489" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:489" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr3.cc glr-regr3.y" at_fn_check_prepare_trace "glr-regression.at:489" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr3.cc glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:489" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:489" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr3 glr-regr3.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr3 glr-regr3.cc $LIBS" "glr-regression.at:489" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr3 glr-regr3.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } cat >input.txt <<'_ATEOF' p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: \$PREPARSER ./glr-regr3 input.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr3 input.txt" "glr-regression.at:489" ( $at_check_trace; $PREPARSER ./glr-regr3 input.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Result: 1c04 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:489: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:489" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:489" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_721 #AT_START_722 at_fn_group_banner 722 'glr-regression.at:490' \ "Improper merging of GLR delayed action sets: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "722. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr3.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Regression Test: Improper merging of GLR delayed action sets. */ /* Reported by M. Rosien */ %code { #include #include static int MergeRule (int x0, int x1); static int yylex (yy::parser::value_type *lvalp); #define RULE(x) (1 << (x)) } %define parse.assert %define parse.trace %glr-parser %expect 1 %expect-rr 2 %skeleton "glr2.cc" %token BAD_CHAR %token P1 P2 T1 T2 T3 T4 O1 O2 %% S : P1 T4 O2 NT6 P2 { printf ("Result: %x\n", $4); } ; NT1 : P1 T1 O1 T2 P2 { $$ = RULE(2); } %merge ; NT2 : NT1 { $$ = RULE(3); } %merge | P1 NT1 O1 T3 P2 { $$ = RULE(4); } %merge ; NT3 : T3 { $$ = RULE(5); } %merge | P1 NT1 O1 T3 P2 { $$ = RULE(6); } %merge ; NT4 : NT3 { $$ = RULE(7); } %merge | NT2 { $$ = RULE(8); } %merge | P1 NT2 O1 NT3 P2 { $$ = RULE(9); } %merge ; NT5 : NT4 { $$ = RULE(10); } %merge ; NT6 : P1 NT1 O1 T3 P2 { $$ = RULE(11) | $2; } %merge | NT5 { $$ = RULE(12) | $1; } %merge ; %% static int MergeRule (int x0, int x1) { return x0 | x1; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } FILE *input = YY_NULLPTR; int P[] = { yy::parser::token::P1, yy::parser::token::P2 }; int O[] = { yy::parser::token::O1, yy::parser::token::O2 }; int T[] = { yy::parser::token::T1, yy::parser::token::T2, yy::parser::token::T3, yy::parser::token::T4 }; int yylex (yy::parser::value_type *lvalp) { char inp[3]; (void) lvalp; assert (!feof (stdin)); if (fscanf (input, "%2s", inp) == EOF) return 0; switch (inp[0]) { case 'p': return P[inp[1] - '1']; case 't': return T[inp[1] - '1']; case 'o': return O[inp[1] - '1']; } return yy::parser::token::BAD_CHAR; } static int yyparse () { yy::parser p; return p.parse (); } int main (int argc, char* argv[]) { int res; input = stdin; if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3; if (getenv ("YYDEBUG")) yydebug = 1; res = yyparse (); if (argc == 2 && fclose (input)) return 4; return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr3.cc glr-regr3.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:490" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr3.cc glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.cc glr-regr3.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.cc glr-regr3.y" "glr-regression.at:490" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr3.cc glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:490" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:490" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:490" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr3.cc glr-regr3.y" at_fn_check_prepare_trace "glr-regression.at:490" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr3.cc glr-regr3.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:490" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:490" printf "%s\n" "glr-regression.at:490" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:490" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr3 glr-regr3.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr3 glr-regr3.cc $LIBS" "glr-regression.at:490" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr3 glr-regr3.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } cat >input.txt <<'_ATEOF' p1 t4 o2 p1 p1 t1 o1 t2 p2 o1 t3 p2 p2 _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: \$PREPARSER ./glr-regr3 input.txt" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr3 input.txt" "glr-regression.at:490" ( $at_check_trace; $PREPARSER ./glr-regr3 input.txt ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Result: 1c04 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:490: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:490" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:490" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_722 #AT_START_723 at_fn_group_banner 723 'glr-regression.at:592' \ "Duplicate representation of merged trees: %union { char *ptr; } glr.c" "" 33 at_xfail=no ( printf "%s\n" "723. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr4.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %type S A A1 A2 B %glr-parser %expect-rr 2 %union { char *ptr; } %skeleton "glr.c" %code { #include static char *merge (YYSTYPE, YYSTYPE); static char *make_value (char const *, char const *); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static char *ptrs[100]; static char **ptrs_next = ptrs; } %% tree: S { printf ("%s\n", $1); } ; S : A %merge { $$ = make_value ("S", $1); } | B %merge { $$ = make_value ("S", $1); } ; A : A1 %merge { $$ = make_value ("A", $1); } | A2 %merge { $$ = make_value ("A", $1); } ; A1: 'a' { $$ = make_value ("A1", "'a'"); } ; A2: 'a' { $$ = make_value ("A2", "'a'"); } ; B: 'a' { $$ = make_value ("B", "'a'"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status = -1; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (ptrs_next != ptrs) free (*--ptrs_next); return status; } static char * make_value (char const *parent, char const *child) { char const format[] = "%s <- %s"; char *value = *ptrs_next++ = YY_CAST (char *, malloc (strlen (parent) + strlen (child) + sizeof format)); sprintf (value, format, parent, child); return value; } static char * merge (YYSTYPE s1, YYSTYPE s2) { char const format[] = "merge{ %s and %s }"; char *res = *ptrs_next++ = YY_CAST (char *, malloc (strlen (s1.ptr) + strlen (s2.ptr) + sizeof format)); sprintf (res, format, s1.ptr, s2.ptr); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr4.c glr-regr4.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:592" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr4.c glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.c glr-regr4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.c glr-regr4.y" "glr-regression.at:592" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.c glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:592" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:592" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:592" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.c glr-regr4.y" at_fn_check_prepare_trace "glr-regression.at:592" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.c glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:592" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:592" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS" "glr-regression.at:592" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: \$PREPARSER ./glr-regr4" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr4" "glr-regression.at:592" ( $at_check_trace; $PREPARSER ./glr-regr4 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:592: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:592" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:592" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_723 #AT_START_724 at_fn_group_banner 724 'glr-regression.at:593' \ "Duplicate representation of merged trees: %union { char *ptr; } glr.cc" "" 33 at_xfail=no ( printf "%s\n" "724. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr4.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %type S A A1 A2 B %glr-parser %expect-rr 2 %union { char *ptr; } %skeleton "glr.cc" %code { #include static char *merge (yy::parser::value_type, yy::parser::value_type); static char *make_value (char const *, char const *); static int yylex (yy::parser::value_type *lvalp); static char *ptrs[100]; static char **ptrs_next = ptrs; } %% tree: S { printf ("%s\n", $1); } ; S : A %merge { $$ = make_value ("S", $1); } | B %merge { $$ = make_value ("S", $1); } ; A : A1 %merge { $$ = make_value ("A", $1); } | A2 %merge { $$ = make_value ("A", $1); } ; A1: 'a' { $$ = make_value ("A1", "'a'"); } ; A2: 'a' { $$ = make_value ("A2", "'a'"); } ; B: 'a' { $$ = make_value ("B", "'a'"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status = -1; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (ptrs_next != ptrs) free (*--ptrs_next); return status; } static char * make_value (char const *parent, char const *child) { char const format[] = "%s <- %s"; char *value = *ptrs_next++ = YY_CAST (char *, malloc (strlen (parent) + strlen (child) + sizeof format)); sprintf (value, format, parent, child); return value; } static char * merge (yy::parser::value_type s1, yy::parser::value_type s2) { char const format[] = "merge{ %s and %s }"; char *res = *ptrs_next++ = YY_CAST (char *, malloc (strlen (s1.ptr) + strlen (s2.ptr) + sizeof format)); sprintf (res, format, s1.ptr, s2.ptr); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:593" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" "glr-regression.at:593" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:593" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:593" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:593" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_trace "glr-regression.at:593" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:593" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:593" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS" "glr-regression.at:593" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: \$PREPARSER ./glr-regr4" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr4" "glr-regression.at:593" ( $at_check_trace; $PREPARSER ./glr-regr4 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:593: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:593" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:593" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_724 #AT_START_725 at_fn_group_banner 725 'glr-regression.at:594' \ "Duplicate representation of merged trees: %union { char *ptr; } glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "725. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr4.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %type S A A1 A2 B %glr-parser %expect-rr 2 %union { char *ptr; } %skeleton "glr2.cc" %code { #include static char *merge (yy::parser::value_type, yy::parser::value_type); static char *make_value (char const *, char const *); static int yylex (yy::parser::value_type *lvalp); static char *ptrs[100]; static char **ptrs_next = ptrs; } %% tree: S { printf ("%s\n", $1); } ; S : A %merge { $$ = make_value ("S", $1); } | B %merge { $$ = make_value ("S", $1); } ; A : A1 %merge { $$ = make_value ("A", $1); } | A2 %merge { $$ = make_value ("A", $1); } ; A1: 'a' { $$ = make_value ("A1", "'a'"); } ; A2: 'a' { $$ = make_value ("A2", "'a'"); } ; B: 'a' { $$ = make_value ("B", "'a'"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status = -1; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (ptrs_next != ptrs) free (*--ptrs_next); return status; } static char * make_value (char const *parent, char const *child) { char const format[] = "%s <- %s"; char *value = *ptrs_next++ = YY_CAST (char *, malloc (strlen (parent) + strlen (child) + sizeof format)); sprintf (value, format, parent, child); return value; } static char * merge (yy::parser::value_type s1, yy::parser::value_type s2) { char const format[] = "merge{ %s and %s }"; char *res = *ptrs_next++ = YY_CAST (char *, malloc (strlen (s1.ptr) + strlen (s2.ptr) + sizeof format)); sprintf (res, format, s1.ptr, s2.ptr); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:594" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" "glr-regression.at:594" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:594" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:594" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:594" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_trace "glr-regression.at:594" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:594" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:594" printf "%s\n" "glr-regression.at:594" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:594" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS" "glr-regression.at:594" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: \$PREPARSER ./glr-regr4" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr4" "glr-regression.at:594" ( $at_check_trace; $PREPARSER ./glr-regr4 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:594: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:594" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:594" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_725 #AT_START_726 at_fn_group_banner 726 'glr-regression.at:596' \ "Duplicate representation of merged trees: api.value.type=union glr.c" "" 33 at_xfail=no ( printf "%s\n" "726. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr4.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %type S A A1 A2 B %glr-parser %expect-rr 2 %define api.value.type union %skeleton "glr.c" %code { #include static char *merge (YYSTYPE, YYSTYPE); static char *make_value (char const *, char const *); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static char *ptrs[100]; static char **ptrs_next = ptrs; } %% tree: S { printf ("%s\n", $1); } ; S : A %merge { $$ = make_value ("S", $1); } | B %merge { $$ = make_value ("S", $1); } ; A : A1 %merge { $$ = make_value ("A", $1); } | A2 %merge { $$ = make_value ("A", $1); } ; A1: 'a' { $$ = make_value ("A1", "'a'"); } ; A2: 'a' { $$ = make_value ("A2", "'a'"); } ; B: 'a' { $$ = make_value ("B", "'a'"); } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status = -1; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (ptrs_next != ptrs) free (*--ptrs_next); return status; } static char * make_value (char const *parent, char const *child) { char const format[] = "%s <- %s"; char *value = *ptrs_next++ = YY_CAST (char *, malloc (strlen (parent) + strlen (child) + sizeof format)); sprintf (value, format, parent, child); return value; } static char * merge (YYSTYPE s1, YYSTYPE s2) { char const format[] = "merge{ %s and %s }"; char *res = *ptrs_next++ = YY_CAST (char *, malloc (strlen (s1.S) + strlen (s2.S) + sizeof format)); sprintf (res, format, s1.S, s2.S); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr4.c glr-regr4.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:596" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr4.c glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.c glr-regr4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.c glr-regr4.y" "glr-regression.at:596" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.c glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:596" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:596" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:596" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.c glr-regr4.y" at_fn_check_prepare_trace "glr-regression.at:596" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.c glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:596" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:596" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS" "glr-regression.at:596" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr4 glr-regr4.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: \$PREPARSER ./glr-regr4" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr4" "glr-regression.at:596" ( $at_check_trace; $PREPARSER ./glr-regr4 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:596: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:596" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:596" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_726 #AT_START_727 at_fn_group_banner 727 'glr-regression.at:597' \ "Duplicate representation of merged trees: api.value.type=union glr.cc" "" 33 at_xfail=no ( printf "%s\n" "727. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr4.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %type S A A1 A2 B %glr-parser %expect-rr 2 %define api.value.type union %skeleton "glr.cc" %code { #include static char *merge (yy::parser::value_type, yy::parser::value_type); static char *make_value (char const *, char const *); static int yylex (yy::parser::value_type *lvalp); static char *ptrs[100]; static char **ptrs_next = ptrs; } %% tree: S { printf ("%s\n", $1); } ; S : A %merge { $$ = make_value ("S", $1); } | B %merge { $$ = make_value ("S", $1); } ; A : A1 %merge { $$ = make_value ("A", $1); } | A2 %merge { $$ = make_value ("A", $1); } ; A1: 'a' { $$ = make_value ("A1", "'a'"); } ; A2: 'a' { $$ = make_value ("A2", "'a'"); } ; B: 'a' { $$ = make_value ("B", "'a'"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status = -1; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (ptrs_next != ptrs) free (*--ptrs_next); return status; } static char * make_value (char const *parent, char const *child) { char const format[] = "%s <- %s"; char *value = *ptrs_next++ = YY_CAST (char *, malloc (strlen (parent) + strlen (child) + sizeof format)); sprintf (value, format, parent, child); return value; } static char * merge (yy::parser::value_type s1, yy::parser::value_type s2) { char const format[] = "merge{ %s and %s }"; char *res = *ptrs_next++ = YY_CAST (char *, malloc (strlen (s1.S) + strlen (s2.S) + sizeof format)); sprintf (res, format, s1.S, s2.S); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:597" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" "glr-regression.at:597" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:597" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:597" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:597" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_trace "glr-regression.at:597" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:597" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:597" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS" "glr-regression.at:597" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: \$PREPARSER ./glr-regr4" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr4" "glr-regression.at:597" ( $at_check_trace; $PREPARSER ./glr-regr4 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:597: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:597" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:597" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_727 #AT_START_728 at_fn_group_banner 728 'glr-regression.at:598' \ "Duplicate representation of merged trees: api.value.type=union glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "728. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr4.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %type S A A1 A2 B %glr-parser %expect-rr 2 %define api.value.type union %skeleton "glr2.cc" %code { #include static char *merge (yy::parser::value_type, yy::parser::value_type); static char *make_value (char const *, char const *); static int yylex (yy::parser::value_type *lvalp); static char *ptrs[100]; static char **ptrs_next = ptrs; } %% tree: S { printf ("%s\n", $1); } ; S : A %merge { $$ = make_value ("S", $1); } | B %merge { $$ = make_value ("S", $1); } ; A : A1 %merge { $$ = make_value ("A", $1); } | A2 %merge { $$ = make_value ("A", $1); } ; A1: 'a' { $$ = make_value ("A1", "'a'"); } ; A2: 'a' { $$ = make_value ("A2", "'a'"); } ; B: 'a' { $$ = make_value ("B", "'a'"); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status = -1; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (ptrs_next != ptrs) free (*--ptrs_next); return status; } static char * make_value (char const *parent, char const *child) { char const format[] = "%s <- %s"; char *value = *ptrs_next++ = YY_CAST (char *, malloc (strlen (parent) + strlen (child) + sizeof format)); sprintf (value, format, parent, child); return value; } static char * merge (yy::parser::value_type s1, yy::parser::value_type s2) { char const format[] = "merge{ %s and %s }"; char *res = *ptrs_next++ = YY_CAST (char *, malloc (strlen (s1.S) + strlen (s2.S) + sizeof format)); sprintf (res, format, s1.S, s2.S); return res; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:598" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y" "glr-regression.at:598" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:598" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:598" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:598" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y" at_fn_check_prepare_trace "glr-regression.at:598" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr4.cc glr-regr4.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:598" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:598" printf "%s\n" "glr-regression.at:598" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:598" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr4 glr-regr4.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS" "glr-regression.at:598" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr4 glr-regr4.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: \$PREPARSER ./glr-regr4" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr4" "glr-regression.at:598" ( $at_check_trace; $PREPARSER ./glr-regr4 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "merge{ S <- merge{ A <- A1 <- 'a' and A <- A2 <- 'a' } and S <- B <- 'a' } " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:598: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:598" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:598" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_728 #AT_START_729 at_fn_group_banner 729 'glr-regression.at:670' \ "User destructor for unresolved GLR semantic value: glr.c" "" 33 at_xfail=no ( printf "%s\n" "729. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr5.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */ } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 1 %skeleton "glr.c" %union { int value; } %type start %destructor { if ($$ != MAGIC_VALUE) { fprintf (stderr, "Bad destructor call.\n"); exit (EXIT_FAILURE); } } start %% start: 'a' { $$ = MAGIC_VALUE; } | 'a' { $$ = MAGIC_VALUE; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr5.c glr-regr5.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:670" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr5.c glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.c glr-regr5.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.c glr-regr5.y" "glr-regression.at:670" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.c glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:670" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:670" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:670" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr5.c glr-regr5.y" at_fn_check_prepare_trace "glr-regression.at:670" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr5.c glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:670" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:670" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr5 glr-regr5.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr5 glr-regr5.c $LIBS" "glr-regression.at:670" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr5 glr-regr5.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: \$PREPARSER ./glr-regr5" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr5" "glr-regression.at:670" ( $at_check_trace; $PREPARSER ./glr-regr5 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:670: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:670" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> 'a' Option 2, start -> 'a' syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:670" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_729 #AT_START_730 at_fn_group_banner 730 'glr-regression.at:671' \ "User destructor for unresolved GLR semantic value: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "730. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr5.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */ } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 1 %skeleton "glr.cc" %union { int value; } %type start %destructor { if ($$ != MAGIC_VALUE) { fprintf (stderr, "Bad destructor call.\n"); exit (EXIT_FAILURE); } } start %% start: 'a' { $$ = MAGIC_VALUE; } | 'a' { $$ = MAGIC_VALUE; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr5.cc glr-regr5.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:671" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr5.cc glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.cc glr-regr5.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.cc glr-regr5.y" "glr-regression.at:671" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.cc glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:671" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:671" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:671" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr5.cc glr-regr5.y" at_fn_check_prepare_trace "glr-regression.at:671" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr5.cc glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:671" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:671" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr5 glr-regr5.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr5 glr-regr5.cc $LIBS" "glr-regression.at:671" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr5 glr-regr5.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: \$PREPARSER ./glr-regr5" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr5" "glr-regression.at:671" ( $at_check_trace; $PREPARSER ./glr-regr5 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:671: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:671" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> 'a' Option 2, start -> 'a' syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:671" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_730 #AT_START_731 at_fn_group_banner 731 'glr-regression.at:672' \ "User destructor for unresolved GLR semantic value: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "731. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr5.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */ } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 1 %skeleton "glr2.cc" %union { int value; } %type start %destructor { if ($$ != MAGIC_VALUE) { fprintf (stderr, "Bad destructor call.\n"); exit (EXIT_FAILURE); } } start %% start: 'a' { $$ = MAGIC_VALUE; } | 'a' { $$ = MAGIC_VALUE; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr5.cc glr-regr5.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:672" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr5.cc glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.cc glr-regr5.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.cc glr-regr5.y" "glr-regression.at:672" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr5.cc glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:672" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:672" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:672" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr5.cc glr-regr5.y" at_fn_check_prepare_trace "glr-regression.at:672" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr5.cc glr-regr5.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:672" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:672" printf "%s\n" "glr-regression.at:672" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:672" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr5 glr-regr5.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr5 glr-regr5.cc $LIBS" "glr-regression.at:672" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr5 glr-regr5.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: \$PREPARSER ./glr-regr5" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr5" "glr-regression.at:672" ( $at_check_trace; $PREPARSER ./glr-regr5 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:672: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:672" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> 'a' Option 2, start -> 'a' syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:672" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_731 #AT_START_732 at_fn_group_banner 732 'glr-regression.at:738' \ "User destructor after an error during a split parse: glr.c" "" 33 at_xfail=no ( printf "%s\n" "732. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr6.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.c" %union { int value; } %type 'a' %destructor { printf ("Destructor called.\n"); } 'a' %% start: 'a' | 'a' ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr6.c glr-regr6.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:738" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr6.c glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.c glr-regr6.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.c glr-regr6.y" "glr-regression.at:738" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.c glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:738" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:738" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:738" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr6.c glr-regr6.y" at_fn_check_prepare_trace "glr-regression.at:738" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr6.c glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:738" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:738" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr6 glr-regr6.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr6 glr-regr6.c $LIBS" "glr-regression.at:738" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr6 glr-regr6.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: \$PREPARSER ./glr-regr6" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr6" "glr-regression.at:738" ( $at_check_trace; $PREPARSER ./glr-regr6 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Destructor called. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:738: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:738" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> 'a' Option 2, start -> 'a' syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:738" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_732 #AT_START_733 at_fn_group_banner 733 'glr-regression.at:739' \ "User destructor after an error during a split parse: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "733. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr6.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.cc" %union { int value; } %type 'a' %destructor { printf ("Destructor called.\n"); } 'a' %% start: 'a' | 'a' ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr6.cc glr-regr6.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:739" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr6.cc glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.cc glr-regr6.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.cc glr-regr6.y" "glr-regression.at:739" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.cc glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:739" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:739" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:739" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr6.cc glr-regr6.y" at_fn_check_prepare_trace "glr-regression.at:739" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr6.cc glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:739" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:739" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr6 glr-regr6.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr6 glr-regr6.cc $LIBS" "glr-regression.at:739" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr6 glr-regr6.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: \$PREPARSER ./glr-regr6" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr6" "glr-regression.at:739" ( $at_check_trace; $PREPARSER ./glr-regr6 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Destructor called. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:739: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:739" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> 'a' Option 2, start -> 'a' syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:739" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_733 #AT_START_734 at_fn_group_banner 734 'glr-regression.at:740' \ "User destructor after an error during a split parse: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "734. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr6.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr2.cc" %union { int value; } %type 'a' %destructor { printf ("Destructor called.\n"); } 'a' %% start: 'a' | 'a' ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr6.cc glr-regr6.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr6.cc glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.cc glr-regr6.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.cc glr-regr6.y" "glr-regression.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr6.cc glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:740" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:740" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:740" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr6.cc glr-regr6.y" at_fn_check_prepare_trace "glr-regression.at:740" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr6.cc glr-regr6.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:740" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:740" printf "%s\n" "glr-regression.at:740" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:740" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr6 glr-regr6.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr6 glr-regr6.cc $LIBS" "glr-regression.at:740" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr6 glr-regr6.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: \$PREPARSER ./glr-regr6" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr6" "glr-regression.at:740" ( $at_check_trace; $PREPARSER ./glr-regr6 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "Destructor called. " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:740: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:740" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> 'a' Option 2, start -> 'a' syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:740" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_734 #AT_START_735 at_fn_group_banner 735 'glr-regression.at:843' \ "Duplicated user destructor for lookahead: glr.c" "" 33 at_xfail=no ( printf "%s\n" "735. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr7.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { typedef struct count_node { int count; struct count_node *prev; } count_node; } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define YYSTACKEXPANDABLE 0 static count_node *tail; } %define parse.assert %define parse.trace %glr-parser %expect-rr 2 %skeleton "glr.c" %union { count_node *node; } %type 'a' %destructor { if ($$->count++) fprintf (stderr, "Destructor called on same value twice.\n"); } 'a' %% start: stack1 start | stack2 start | %empty ; stack1: 'a' ; stack2: 'a' ; %% int yylex (void) { (yylval).node = YY_CAST (count_node*, malloc (sizeof *(yylval).node)); if (!(yylval).node) { fprintf (stderr, "Test inconclusive.\n"); exit (EXIT_FAILURE); } (yylval).node->count = 0; (yylval).node->prev = tail; tail = (yylval).node; return 'a'; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (tail) { count_node *prev = tail->prev; free (tail); tail = prev; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr7.c glr-regr7.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr7.c glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.c glr-regr7.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.c glr-regr7.y" "glr-regression.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.c glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:843" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:843" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:843" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr7.c glr-regr7.y" at_fn_check_prepare_trace "glr-regression.at:843" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr7.c glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:843" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:843" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr7 glr-regr7.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr7 glr-regr7.c $LIBS" "glr-regression.at:843" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr7 glr-regr7.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: \$PREPARSER ./glr-regr7" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr7" "glr-regression.at:843" ( $at_check_trace; $PREPARSER ./glr-regr7 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:843: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:843" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:843" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_735 #AT_START_736 at_fn_group_banner 736 'glr-regression.at:844' \ "Duplicated user destructor for lookahead: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "736. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr7.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { typedef struct count_node { int count; struct count_node *prev; } count_node; } %code { static int yylex (yy::parser::value_type *lvalp); #define YYSTACKEXPANDABLE 0 static count_node *tail; } %define parse.assert %define parse.trace %glr-parser %expect-rr 2 %skeleton "glr.cc" %union { count_node *node; } %type 'a' %destructor { if ($$->count++) fprintf (stderr, "Destructor called on same value twice.\n"); } 'a' %% start: stack1 start | stack2 start | %empty ; stack1: 'a' ; stack2: 'a' ; %% int yylex (yy::parser::value_type *lvalp) { (void) lvalp; (*lvalp).node = YY_CAST (count_node*, malloc (sizeof *(*lvalp).node)); if (!(*lvalp).node) { fprintf (stderr, "Test inconclusive.\n"); exit (EXIT_FAILURE); } (*lvalp).node->count = 0; (*lvalp).node->prev = tail; tail = (*lvalp).node; return 'a'; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (tail) { count_node *prev = tail->prev; free (tail); tail = prev; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr7.cc glr-regr7.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:844" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr7.cc glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.cc glr-regr7.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.cc glr-regr7.y" "glr-regression.at:844" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.cc glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:844" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:844" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:844" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr7.cc glr-regr7.y" at_fn_check_prepare_trace "glr-regression.at:844" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr7.cc glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:844" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:844" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr7 glr-regr7.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr7 glr-regr7.cc $LIBS" "glr-regression.at:844" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr7 glr-regr7.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: \$PREPARSER ./glr-regr7" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr7" "glr-regression.at:844" ( $at_check_trace; $PREPARSER ./glr-regr7 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:844: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:844" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:844" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_736 #AT_START_737 at_fn_group_banner 737 'glr-regression.at:845' \ "Duplicated user destructor for lookahead: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "737. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr7.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code requires { typedef struct count_node { int count; struct count_node *prev; } count_node; } %code { static int yylex (yy::parser::value_type *lvalp); #define YYSTACKEXPANDABLE 0 static count_node *tail; } %define parse.assert %define parse.trace %glr-parser %expect-rr 2 %skeleton "glr2.cc" %union { count_node *node; } %type 'a' %destructor { if ($$->count++) fprintf (stderr, "Destructor called on same value twice.\n"); } 'a' %% start: stack1 start | stack2 start | %empty ; stack1: 'a' ; stack2: 'a' ; %% int yylex (yy::parser::value_type *lvalp) { (void) lvalp; (*lvalp).node = YY_CAST (count_node*, malloc (sizeof *(*lvalp).node)); if (!(*lvalp).node) { fprintf (stderr, "Test inconclusive.\n"); exit (EXIT_FAILURE); } (*lvalp).node->count = 0; (*lvalp).node->prev = tail; tail = (*lvalp).node; return 'a'; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); while (tail) { count_node *prev = tail->prev; free (tail); tail = prev; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr7.cc glr-regr7.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:845" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr7.cc glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.cc glr-regr7.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.cc glr-regr7.y" "glr-regression.at:845" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr7.cc glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:845" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:845" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:845" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr7.cc glr-regr7.y" at_fn_check_prepare_trace "glr-regression.at:845" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr7.cc glr-regr7.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:845" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:845" printf "%s\n" "glr-regression.at:845" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:845" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr7 glr-regr7.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr7 glr-regr7.cc $LIBS" "glr-regression.at:845" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr7 glr-regr7.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: \$PREPARSER ./glr-regr7" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr7" "glr-regression.at:845" ( $at_check_trace; $PREPARSER ./glr-regr7 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:845: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:845" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:845" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_737 #AT_START_738 at_fn_group_banner 738 'glr-regression.at:944' \ "Incorrectly initialized location for empty right-hand side in GLR: glr.c" "" 33 at_xfail=no ( printf "%s\n" "738. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr8.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.c" %token T_CONSTANT %token T_PORT %token T_SIGNAL %% PortClause : T_PORT InterfaceDeclaration T_PORT { printf("%d/%d - %d/%d - %d/%d\n", @1.first_column, @1.last_column, @2.first_column, @2.last_column, @3.first_column, @3.last_column); } ; InterfaceDeclaration : OptConstantWord %dprec 1 | OptSignalWord %dprec 2 ; OptConstantWord : %empty | T_CONSTANT ; OptSignalWord : %empty { printf("empty: %d/%d\n", @$.first_column, @$.last_column); } | T_SIGNAL ; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static int lexIndex; int yylex (void) { lexIndex += 1; switch (lexIndex) { default: abort (); case 1: (yylloc).first_column = 1; (yylloc).last_column = 9; return T_PORT; case 2: (yylloc).first_column = 13; (yylloc).last_column = 17; return T_PORT; case 3: return 0; } } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr8.c glr-regr8.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:944" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr8.c glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.c glr-regr8.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.c glr-regr8.y" "glr-regression.at:944" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.c glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:944" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:944" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:944" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr8.c glr-regr8.y" at_fn_check_prepare_trace "glr-regression.at:944" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr8.c glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:944" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:944" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr8 glr-regr8.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr8 glr-regr8.c $LIBS" "glr-regression.at:944" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr8 glr-regr8.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: \$PREPARSER ./glr-regr8" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr8" "glr-regression.at:944" ( $at_check_trace; $PREPARSER ./glr-regr8 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "empty: 9/9 1/9 - 9/9 - 13/17 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:944: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:944" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:944" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_738 #AT_START_739 at_fn_group_banner 739 'glr-regression.at:945' \ "Incorrectly initialized location for empty right-hand side in GLR: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "739. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr8.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.cc" %token T_CONSTANT %token T_PORT %token T_SIGNAL %% PortClause : T_PORT InterfaceDeclaration T_PORT { printf("%d/%d - %d/%d - %d/%d\n", @1.begin.column, @1.end.column, @2.begin.column, @2.end.column, @3.begin.column, @3.end.column); } ; InterfaceDeclaration : OptConstantWord %dprec 1 | OptSignalWord %dprec 2 ; OptConstantWord : %empty | T_CONSTANT ; OptSignalWord : %empty { printf("empty: %d/%d\n", @$.begin.column, @$.end.column); } | T_SIGNAL ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int lexIndex; int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { (void) lvalp;(void) llocp; lexIndex += 1; switch (lexIndex) { default: abort (); case 1: (*llocp).begin.column = 1; (*llocp).end.column = 9; return yy::parser::token::T_PORT; case 2: (*llocp).begin.column = 13; (*llocp).end.column = 17; return yy::parser::token::T_PORT; case 3: return 0; } } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr8.cc glr-regr8.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:945" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr8.cc glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.cc glr-regr8.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.cc glr-regr8.y" "glr-regression.at:945" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.cc glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:945" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:945" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:945" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr8.cc glr-regr8.y" at_fn_check_prepare_trace "glr-regression.at:945" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr8.cc glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:945" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:945" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr8 glr-regr8.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr8 glr-regr8.cc $LIBS" "glr-regression.at:945" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr8 glr-regr8.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: \$PREPARSER ./glr-regr8" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr8" "glr-regression.at:945" ( $at_check_trace; $PREPARSER ./glr-regr8 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "empty: 9/9 1/9 - 9/9 - 13/17 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:945: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:945" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:945" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_739 #AT_START_740 at_fn_group_banner 740 'glr-regression.at:946' \ "Incorrectly initialized location for empty right-hand side in GLR: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "740. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr8.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr2.cc" %token T_CONSTANT %token T_PORT %token T_SIGNAL %% PortClause : T_PORT InterfaceDeclaration T_PORT { printf("%d/%d - %d/%d - %d/%d\n", @1.begin.column, @1.end.column, @2.begin.column, @2.end.column, @3.begin.column, @3.end.column); } ; InterfaceDeclaration : OptConstantWord %dprec 1 | OptSignalWord %dprec 2 ; OptConstantWord : %empty | T_CONSTANT ; OptSignalWord : %empty { printf("empty: %d/%d\n", @$.begin.column, @$.end.column); } | T_SIGNAL ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int lexIndex; int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { (void) lvalp;(void) llocp; lexIndex += 1; switch (lexIndex) { default: abort (); case 1: (*llocp).begin.column = 1; (*llocp).end.column = 9; return yy::parser::token::T_PORT; case 2: (*llocp).begin.column = 13; (*llocp).end.column = 17; return yy::parser::token::T_PORT; case 3: return 0; } } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr8.cc glr-regr8.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:946" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr8.cc glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.cc glr-regr8.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.cc glr-regr8.y" "glr-regression.at:946" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr8.cc glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:946" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:946" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:946" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr8.cc glr-regr8.y" at_fn_check_prepare_trace "glr-regression.at:946" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr8.cc glr-regr8.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:946" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:946" printf "%s\n" "glr-regression.at:946" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:946" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr8 glr-regr8.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr8 glr-regr8.cc $LIBS" "glr-regression.at:946" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr8 glr-regr8.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: \$PREPARSER ./glr-regr8" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr8" "glr-regression.at:946" ( $at_check_trace; $PREPARSER ./glr-regr8 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "empty: 9/9 1/9 - 9/9 - 13/17 " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:946: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:946" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:946" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_740 #AT_START_741 at_fn_group_banner 741 'glr-regression.at:1036' \ "No users destructors if stack 0 deleted: glr.c" " " 33 at_xfail=no ( printf "%s\n" "741. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr9.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); # define YYSTACKEXPANDABLE 0 static int tokens = 0; static int destructors = 0; # define USE(Var) } %define parse.assert %define parse.trace %glr-parser %expect-rr 2 %skeleton "glr.c" %union { int dummy; } %type 'a' %destructor { destructors += 1; } 'a' %% start: ambig0 'a' { destructors += 2; USE ($2); } | ambig1 start { destructors += 1; } | ambig2 start { destructors += 1; } ; ambig0: 'a' ; ambig1: 'a' ; ambig2: 'a' ; %% int yylex (void) { tokens += 1; return 'a'; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (tokens != destructors) { fprintf (stderr, "Tokens = %d, Destructors = %d\n", tokens, destructors); return 10; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr9.c glr-regr9.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1036" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr9.c glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.c glr-regr9.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.c glr-regr9.y" "glr-regression.at:1036" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.c glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1036" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1036" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1036" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr9.c glr-regr9.y" at_fn_check_prepare_trace "glr-regression.at:1036" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr9.c glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1036" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1036" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr9 glr-regr9.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr9 glr-regr9.c $LIBS" "glr-regression.at:1036" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr9 glr-regr9.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } # Exit 2: memory exhausted. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: \$PREPARSER ./glr-regr9" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr9" "glr-regression.at:1036" ( $at_check_trace; $PREPARSER ./glr-regr9 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1036: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1036" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1036" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_741 #AT_START_742 at_fn_group_banner 742 'glr-regression.at:1037' \ "No users destructors if stack 0 deleted: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "742. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr9.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); # define YYSTACKEXPANDABLE 0 static int tokens = 0; static int destructors = 0; # define USE(Var) } %define parse.assert %define parse.trace %glr-parser %expect-rr 2 %skeleton "glr.cc" %union { int dummy; } %type 'a' %destructor { destructors += 1; } 'a' %% start: ambig0 'a' { destructors += 2; USE ($2); } | ambig1 start { destructors += 1; } | ambig2 start { destructors += 1; } ; ambig0: 'a' ; ambig1: 'a' ; ambig2: 'a' ; %% int yylex (yy::parser::value_type *lvalp) { (void) lvalp; tokens += 1; return 'a'; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (tokens != destructors) { fprintf (stderr, "Tokens = %d, Destructors = %d\n", tokens, destructors); return 10; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr9.cc glr-regr9.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1037" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr9.cc glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.cc glr-regr9.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.cc glr-regr9.y" "glr-regression.at:1037" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.cc glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1037" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1037" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1037" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr9.cc glr-regr9.y" at_fn_check_prepare_trace "glr-regression.at:1037" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr9.cc glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1037" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1037" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr9 glr-regr9.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr9 glr-regr9.cc $LIBS" "glr-regression.at:1037" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr9 glr-regr9.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } # Exit 2: memory exhausted. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: \$PREPARSER ./glr-regr9" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr9" "glr-regression.at:1037" ( $at_check_trace; $PREPARSER ./glr-regr9 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1037: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1037" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1037" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_742 #AT_START_743 at_fn_group_banner 743 'glr-regression.at:1038' \ "No users destructors if stack 0 deleted: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "743. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr9.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); # define YYSTACKEXPANDABLE 0 static int tokens = 0; static int destructors = 0; # define USE(Var) } %define parse.assert %define parse.trace %glr-parser %expect-rr 2 %skeleton "glr2.cc" %union { int dummy; } %type 'a' %destructor { destructors += 1; } 'a' %% start: ambig0 'a' { destructors += 2; USE ($2); } | ambig1 start { destructors += 1; } | ambig2 start { destructors += 1; } ; ambig0: 'a' ; ambig1: 'a' ; ambig2: 'a' ; %% int yylex (yy::parser::value_type *lvalp) { (void) lvalp; tokens += 1; return 'a'; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (tokens != destructors) { fprintf (stderr, "Tokens = %d, Destructors = %d\n", tokens, destructors); return 10; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr9.cc glr-regr9.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1038" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr9.cc glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.cc glr-regr9.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.cc glr-regr9.y" "glr-regression.at:1038" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr9.cc glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1038" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1038" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1038" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr9.cc glr-regr9.y" at_fn_check_prepare_trace "glr-regression.at:1038" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr9.cc glr-regr9.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1038" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1038" printf "%s\n" "glr-regression.at:1038" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1038" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr9 glr-regr9.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr9 glr-regr9.cc $LIBS" "glr-regression.at:1038" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr9 glr-regr9.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } # Exit 2: memory exhausted. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: \$PREPARSER ./glr-regr9" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr9" "glr-regression.at:1038" ( $at_check_trace; $PREPARSER ./glr-regr9 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 2 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1038: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1038" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "memory exhausted " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1038" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_743 #AT_START_744 at_fn_group_banner 744 'glr-regression.at:1102' \ "Corrupted semantic options if user action cuts parse: glr.c" "" 33 at_xfail=no ( printf "%s\n" "744. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr10.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); #define GARBAGE_SIZE 50 static char garbage[GARBAGE_SIZE]; } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.c" %union { char *ptr; } %type start %% start: %dprec 2 { $$ = garbage; YYACCEPT; } | %dprec 1 { $$ = garbage; YYACCEPT; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int i; for (i = 0; i < GARBAGE_SIZE; i+=1) garbage[i] = 108; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr10.c glr-regr10.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1102" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr10.c glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.c glr-regr10.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.c glr-regr10.y" "glr-regression.at:1102" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.c glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1102" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1102" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1102" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr10.c glr-regr10.y" at_fn_check_prepare_trace "glr-regression.at:1102" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr10.c glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1102" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1102" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr10 glr-regr10.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr10 glr-regr10.c $LIBS" "glr-regression.at:1102" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr10 glr-regr10.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: \$PREPARSER ./glr-regr10" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr10" "glr-regression.at:1102" ( $at_check_trace; $PREPARSER ./glr-regr10 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1102: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1102" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1102" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_744 #AT_START_745 at_fn_group_banner 745 'glr-regression.at:1103' \ "Corrupted semantic options if user action cuts parse: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "745. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr10.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); #define GARBAGE_SIZE 50 static char garbage[GARBAGE_SIZE]; } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.cc" %union { char *ptr; } %type start %% start: %dprec 2 { $$ = garbage; YYACCEPT; } | %dprec 1 { $$ = garbage; YYACCEPT; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int i; for (i = 0; i < GARBAGE_SIZE; i+=1) garbage[i] = 108; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr10.cc glr-regr10.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1103" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr10.cc glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.cc glr-regr10.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.cc glr-regr10.y" "glr-regression.at:1103" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.cc glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1103" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1103" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1103" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr10.cc glr-regr10.y" at_fn_check_prepare_trace "glr-regression.at:1103" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr10.cc glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1103" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1103" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr10 glr-regr10.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr10 glr-regr10.cc $LIBS" "glr-regression.at:1103" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr10 glr-regr10.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: \$PREPARSER ./glr-regr10" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr10" "glr-regression.at:1103" ( $at_check_trace; $PREPARSER ./glr-regr10 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1103: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1103" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1103" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_745 #AT_START_746 at_fn_group_banner 746 'glr-regression.at:1104' \ "Corrupted semantic options if user action cuts parse: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "746. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr10.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); #define GARBAGE_SIZE 50 static char garbage[GARBAGE_SIZE]; } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr2.cc" %union { char *ptr; } %type start %% start: %dprec 2 { $$ = garbage; YYACCEPT; } | %dprec 1 { $$ = garbage; YYACCEPT; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int i; for (i = 0; i < GARBAGE_SIZE; i+=1) garbage[i] = 108; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr10.cc glr-regr10.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1104" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr10.cc glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.cc glr-regr10.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.cc glr-regr10.y" "glr-regression.at:1104" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr10.cc glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1104" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1104" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1104" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr10.cc glr-regr10.y" at_fn_check_prepare_trace "glr-regression.at:1104" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr10.cc glr-regr10.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1104" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1104" printf "%s\n" "glr-regression.at:1104" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1104" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr10 glr-regr10.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr10 glr-regr10.cc $LIBS" "glr-regression.at:1104" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr10 glr-regr10.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: \$PREPARSER ./glr-regr10" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr10" "glr-regression.at:1104" ( $at_check_trace; $PREPARSER ./glr-regr10 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1104: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1104" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1104" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_746 #AT_START_747 at_fn_group_banner 747 'glr-regression.at:1174' \ "Undesirable destructors if user action cuts parse: glr.c" "" 33 at_xfail=no ( printf "%s\n" "747. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr11.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static int destructors = 0; # define USE(val) } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.c" %union { int dummy; } %type 'a' %destructor { destructors += 1; } 'a' %% start: 'a' %dprec 2 { USE ($1); destructors += 1; YYACCEPT; } | 'a' %dprec 1 { USE ($1); destructors += 1; YYACCEPT; } ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "a"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (destructors != 1) { fprintf (stderr, "Destructor calls: %d\n", destructors); return 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr11.c glr-regr11.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1174" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr11.c glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.c glr-regr11.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.c glr-regr11.y" "glr-regression.at:1174" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.c glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1174" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1174" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1174" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr11.c glr-regr11.y" at_fn_check_prepare_trace "glr-regression.at:1174" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr11.c glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1174" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1174" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr11 glr-regr11.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr11 glr-regr11.c $LIBS" "glr-regression.at:1174" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr11 glr-regr11.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: \$PREPARSER ./glr-regr11" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr11" "glr-regression.at:1174" ( $at_check_trace; $PREPARSER ./glr-regr11 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1174: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1174" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1174" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_747 #AT_START_748 at_fn_group_banner 748 'glr-regression.at:1175' \ "Undesirable destructors if user action cuts parse: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "748. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr11.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); static int destructors = 0; # define USE(val) } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr.cc" %union { int dummy; } %type 'a' %destructor { destructors += 1; } 'a' %% start: 'a' %dprec 2 { USE ($1); destructors += 1; YYACCEPT; } | 'a' %dprec 1 { USE ($1); destructors += 1; YYACCEPT; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (destructors != 1) { fprintf (stderr, "Destructor calls: %d\n", destructors); return 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr11.cc glr-regr11.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr11.cc glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.cc glr-regr11.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.cc glr-regr11.y" "glr-regression.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.cc glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1175" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1175" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1175" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr11.cc glr-regr11.y" at_fn_check_prepare_trace "glr-regression.at:1175" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr11.cc glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1175" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1175" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr11 glr-regr11.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr11 glr-regr11.cc $LIBS" "glr-regression.at:1175" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr11 glr-regr11.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: \$PREPARSER ./glr-regr11" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr11" "glr-regression.at:1175" ( $at_check_trace; $PREPARSER ./glr-regr11 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1175: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1175" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1175" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_748 #AT_START_749 at_fn_group_banner 749 'glr-regression.at:1176' \ "Undesirable destructors if user action cuts parse: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "749. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr11.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); static int destructors = 0; # define USE(val) } %define parse.assert %define parse.trace %glr-parser %expect-rr 1 %skeleton "glr2.cc" %union { int dummy; } %type 'a' %destructor { destructors += 1; } 'a' %% start: 'a' %dprec 2 { USE ($1); destructors += 1; YYACCEPT; } | 'a' %dprec 1 { USE ($1); destructors += 1; YYACCEPT; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "a"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (destructors != 1) { fprintf (stderr, "Destructor calls: %d\n", destructors); return 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr11.cc glr-regr11.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1176" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr11.cc glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.cc glr-regr11.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.cc glr-regr11.y" "glr-regression.at:1176" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr11.cc glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1176" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1176" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1176" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr11.cc glr-regr11.y" at_fn_check_prepare_trace "glr-regression.at:1176" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr11.cc glr-regr11.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1176" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1176" printf "%s\n" "glr-regression.at:1176" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1176" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr11 glr-regr11.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr11 glr-regr11.cc $LIBS" "glr-regression.at:1176" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr11 glr-regr11.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: \$PREPARSER ./glr-regr11" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr11" "glr-regression.at:1176" ( $at_check_trace; $PREPARSER ./glr-regr11 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1176: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1176" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1176" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_749 #AT_START_750 at_fn_group_banner 750 'glr-regression.at:1310' \ "Leaked semantic values if user action cuts parse: glr.c" "" 33 at_xfail=no ( printf "%s\n" "750. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr12.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 1 %expect-rr 1 %skeleton "glr.c" %union { int dummy; } %token PARENT_RHS_AFTER %type parent_rhs_before merged PARENT_RHS_AFTER %destructor { parent_rhs_before_value = 0; } parent_rhs_before %destructor { merged_value = 0; } merged %destructor { parent_rhs_after_value = 0; } PARENT_RHS_AFTER %code { # include static int merge (YYSTYPE, YYSTYPE); #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static int parent_rhs_before_value = 0; static int merged_value = 0; static int parent_rhs_after_value = 0; # define USE(val) } %% start: alt1 %dprec 1 | alt2 %dprec 2 ; alt1: PARENT_RHS_AFTER { USE ($1); parent_rhs_after_value = 0; } ; alt2: parent_rhs_before merged PARENT_RHS_AFTER { USE (($1, $2, $3)); parent_rhs_before_value = 0; merged_value = 0; parent_rhs_after_value = 0; } ; parent_rhs_before: { USE ($$); parent_rhs_before_value = 1; } ; merged: %merge { USE ($$); merged_value = 1; } | cut %merge { USE ($$); merged_value = 1; } ; cut: { YYACCEPT; } ; %% static int merge (YYSTYPE s1, YYSTYPE s2) { /* Not invoked. */ return s1.dummy + s2.dummy; } /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static int const input[] = { PARENT_RHS_AFTER, 0 }; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == PARENT_RHS_AFTER) parent_rhs_after_value = 1;; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (parent_rhs_before_value) { fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); status = 1; } if (merged_value) { fprintf (stderr, "'merged' destructor not called.\n"); status = 1; } if (parent_rhs_after_value) { fprintf (stderr, "'PARENT_RHS_AFTER' destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr12.c glr-regr12.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr12.c glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.c glr-regr12.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.c glr-regr12.y" "glr-regression.at:1310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.c glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1310" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1310" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1310" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr12.c glr-regr12.y" at_fn_check_prepare_trace "glr-regression.at:1310" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr12.c glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1310" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1310" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr12 glr-regr12.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr12 glr-regr12.c $LIBS" "glr-regression.at:1310" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr12 glr-regr12.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: \$PREPARSER ./glr-regr12" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr12" "glr-regression.at:1310" ( $at_check_trace; $PREPARSER ./glr-regr12 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1310: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1310" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1310" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_750 #AT_START_751 at_fn_group_banner 751 'glr-regression.at:1311' \ "Leaked semantic values if user action cuts parse: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "751. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr12.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 1 %expect-rr 1 %skeleton "glr.cc" %union { int dummy; } %token PARENT_RHS_AFTER %type parent_rhs_before merged PARENT_RHS_AFTER %destructor { parent_rhs_before_value = 0; } parent_rhs_before %destructor { merged_value = 0; } merged %destructor { parent_rhs_after_value = 0; } PARENT_RHS_AFTER %code { # include static int merge (yy::parser::value_type, yy::parser::value_type); static int yylex (yy::parser::value_type *lvalp); static int parent_rhs_before_value = 0; static int merged_value = 0; static int parent_rhs_after_value = 0; # define USE(val) } %% start: alt1 %dprec 1 | alt2 %dprec 2 ; alt1: PARENT_RHS_AFTER { USE ($1); parent_rhs_after_value = 0; } ; alt2: parent_rhs_before merged PARENT_RHS_AFTER { USE (($1, $2, $3)); parent_rhs_before_value = 0; merged_value = 0; parent_rhs_after_value = 0; } ; parent_rhs_before: { USE ($$); parent_rhs_before_value = 1; } ; merged: %merge { USE ($$); merged_value = 1; } | cut %merge { USE ($$); merged_value = 1; } ; cut: { YYACCEPT; } ; %% static int merge (yy::parser::value_type s1, yy::parser::value_type s2) { /* Not invoked. */ return s1.dummy + s2.dummy; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { yy::parser::token::PARENT_RHS_AFTER, 0 }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == yy::parser::token::PARENT_RHS_AFTER) parent_rhs_after_value = 1;; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (parent_rhs_before_value) { fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); status = 1; } if (merged_value) { fprintf (stderr, "'merged' destructor not called.\n"); status = 1; } if (parent_rhs_after_value) { fprintf (stderr, "'PARENT_RHS_AFTER' destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr12.cc glr-regr12.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1311" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr12.cc glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.cc glr-regr12.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.cc glr-regr12.y" "glr-regression.at:1311" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.cc glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1311" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1311" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1311" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr12.cc glr-regr12.y" at_fn_check_prepare_trace "glr-regression.at:1311" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr12.cc glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1311" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1311" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr12 glr-regr12.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr12 glr-regr12.cc $LIBS" "glr-regression.at:1311" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr12 glr-regr12.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: \$PREPARSER ./glr-regr12" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr12" "glr-regression.at:1311" ( $at_check_trace; $PREPARSER ./glr-regr12 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1311: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1311" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1311" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_751 #AT_START_752 at_fn_group_banner 752 'glr-regression.at:1312' \ "Leaked semantic values if user action cuts parse: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "752. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr12.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 1 %expect-rr 1 %skeleton "glr2.cc" %union { int dummy; } %token PARENT_RHS_AFTER %type parent_rhs_before merged PARENT_RHS_AFTER %destructor { parent_rhs_before_value = 0; } parent_rhs_before %destructor { merged_value = 0; } merged %destructor { parent_rhs_after_value = 0; } PARENT_RHS_AFTER %code { # include static int merge (yy::parser::value_type, yy::parser::value_type); static int yylex (yy::parser::value_type *lvalp); static int parent_rhs_before_value = 0; static int merged_value = 0; static int parent_rhs_after_value = 0; # define USE(val) } %% start: alt1 %dprec 1 | alt2 %dprec 2 ; alt1: PARENT_RHS_AFTER { USE ($1); parent_rhs_after_value = 0; } ; alt2: parent_rhs_before merged PARENT_RHS_AFTER { USE (($1, $2, $3)); parent_rhs_before_value = 0; merged_value = 0; parent_rhs_after_value = 0; } ; parent_rhs_before: { USE ($$); parent_rhs_before_value = 1; } ; merged: %merge { USE ($$); merged_value = 1; } | cut %merge { USE ($$); merged_value = 1; } ; cut: { YYACCEPT; } ; %% static int merge (yy::parser::value_type s1, yy::parser::value_type s2) { /* Not invoked. */ return s1.dummy + s2.dummy; } /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static int const input[] = { yy::parser::token::PARENT_RHS_AFTER, 0 }; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == yy::parser::token::PARENT_RHS_AFTER) parent_rhs_after_value = 1;; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse (); if (parent_rhs_before_value) { fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); status = 1; } if (merged_value) { fprintf (stderr, "'merged' destructor not called.\n"); status = 1; } if (parent_rhs_after_value) { fprintf (stderr, "'PARENT_RHS_AFTER' destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr12.cc glr-regr12.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1312" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr12.cc glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.cc glr-regr12.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.cc glr-regr12.y" "glr-regression.at:1312" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr12.cc glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1312" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1312" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1312" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr12.cc glr-regr12.y" at_fn_check_prepare_trace "glr-regression.at:1312" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr12.cc glr-regr12.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1312" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1312" printf "%s\n" "glr-regression.at:1312" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1312" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr12 glr-regr12.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr12 glr-regr12.cc $LIBS" "glr-regression.at:1312" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr12 glr-regr12.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: \$PREPARSER ./glr-regr12" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr12" "glr-regression.at:1312" ( $at_check_trace; $PREPARSER ./glr-regr12 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1312: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1312" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1312" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_752 #AT_START_753 at_fn_group_banner 753 'glr-regression.at:1445' \ "Incorrect lookahead during deterministic GLR: glr.c" "" 33 at_xfail=no ( printf "%s\n" "753. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr13.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Tests: - Defaulted state with initial yychar: yychar == YYEMPTY. - Nondefaulted state: yychar != YYEMPTY. - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - User action changing the lookahead. */ %code { #include #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static void print_lookahead (int yychr, YYSTYPE *yylvalp, YYLTYPE *yyllocp, char const *reduction); #define PRINT_LOOKAHEAD(Msg) \ print_lookahead (yychar, &yylval, &yylloc, Msg) #define USE(value) } %define parse.assert %define parse.trace %locations %glr-parser %skeleton "glr.c" %union { char value; } %type 'a' 'b' %% start: defstate_init defstate_shift 'b' change_lookahead 'a' { USE ($3); PRINT_LOOKAHEAD ("start <- defstate_init defstate_shift 'b'"); } ; defstate_init: %empty { PRINT_LOOKAHEAD ("defstate_init <- empty string"); } ; defstate_shift: nondefstate defstate_look 'a' { USE ($3); PRINT_LOOKAHEAD ("defstate_shift <- nondefstate defstate_look 'a'"); } ; defstate_look: %empty { PRINT_LOOKAHEAD ("defstate_look <- empty string"); } ; nondefstate: %empty { PRINT_LOOKAHEAD ("nondefstate <- empty string"); } | 'b' { USE ($1); PRINT_LOOKAHEAD ("nondefstate <- 'b'"); } ; change_lookahead: %empty { yychar = 'a'; } ; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static void print_lookahead (int yychr, YYSTYPE *yylvalp, YYLTYPE *yyllocp, char const *reduction) { printf ("%s:\n yychar=", reduction); if (yychr == YYEMPTY) printf ("YYEMPTY"); else if (yychr == YYEOF) printf ("YYEOF"); else { printf ("'%c', yylval='", yychr); if (yylvalp->value > ' ') printf ("%c", yylvalp->value); printf ("', yylloc=(%d,%d),(%d,%d)", yyllocp->first_line, yyllocp->first_column, yyllocp->last_line, yyllocp->last_column); } printf ("\n"); } #include static int yylex (void) { static char const input[] = "ab"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (yylval).value = YY_CAST (char, res + 'A' - 'a'); (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum; return res; } int main (void) { yychar = '#'; /* Not a token in the grammar. */ yylval.value = '!'; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr13.c glr-regr13.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr13.c glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.c glr-regr13.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.c glr-regr13.y" "glr-regression.at:1445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.c glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1445" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1445" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1445" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr13.c glr-regr13.y" at_fn_check_prepare_trace "glr-regression.at:1445" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr13.c glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1445" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1445" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr13 glr-regr13.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr13 glr-regr13.c $LIBS" "glr-regression.at:1445" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr13 glr-regr13.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: \$PREPARSER ./glr-regr13" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr13" "glr-regression.at:1445" ( $at_check_trace; $PREPARSER ./glr-regr13 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "defstate_init <- empty string: yychar=YYEMPTY nondefstate <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_look <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_shift <- nondefstate defstate_look 'a': yychar=YYEMPTY start <- defstate_init defstate_shift 'b': yychar=YYEMPTY " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1445: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1445" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1445" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_753 #AT_START_754 at_fn_group_banner 754 'glr-regression.at:1446' \ "Incorrect lookahead during deterministic GLR: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "754. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr13.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Tests: - Defaulted state with initial yychar: yychar == YYEMPTY. - Nondefaulted state: yychar != YYEMPTY. - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - User action changing the lookahead. */ %code { #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static void print_lookahead (int yychr, yy::parser::value_type *yylvalp, yy::parser::location_type *yyllocp, char const *reduction); #define PRINT_LOOKAHEAD(Msg) \ print_lookahead (yychar, &yylval, &yylloc, Msg) #define USE(value) } %define parse.assert %define parse.trace %locations %glr-parser %skeleton "glr.cc" %union { char value; } %type 'a' 'b' %% start: defstate_init defstate_shift 'b' change_lookahead 'a' { USE ($3); PRINT_LOOKAHEAD ("start <- defstate_init defstate_shift 'b'"); } ; defstate_init: %empty { PRINT_LOOKAHEAD ("defstate_init <- empty string"); } ; defstate_shift: nondefstate defstate_look 'a' { USE ($3); PRINT_LOOKAHEAD ("defstate_shift <- nondefstate defstate_look 'a'"); } ; defstate_look: %empty { PRINT_LOOKAHEAD ("defstate_look <- empty string"); } ; nondefstate: %empty { PRINT_LOOKAHEAD ("nondefstate <- empty string"); } | 'b' { USE ($1); PRINT_LOOKAHEAD ("nondefstate <- 'b'"); } ; change_lookahead: %empty { yychar = 'a'; } ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } static void print_lookahead (int yychr, yy::parser::value_type *yylvalp, yy::parser::location_type *yyllocp, char const *reduction) { printf ("%s:\n yychar=", reduction); if (yychr == yy::parser::token::YYEMPTY) printf ("YYEMPTY"); else if (yychr == yy::parser::token::YYEOF) printf ("YYEOF"); else { printf ("'%c', yylval='", yychr); if (yylvalp->value > ' ') printf ("%c", yylvalp->value); printf ("', yylloc=(%d,%d),(%d,%d)", yyllocp->begin.line, yyllocp->begin.column, yyllocp->end.line, yyllocp->end.column); } printf ("\n"); } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "ab"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (*lvalp).value = YY_CAST (char, res + 'A' - 'a'); (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int main (void) { if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr13.cc glr-regr13.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1446" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr13.cc glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.cc glr-regr13.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.cc glr-regr13.y" "glr-regression.at:1446" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.cc glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1446" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1446" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1446" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr13.cc glr-regr13.y" at_fn_check_prepare_trace "glr-regression.at:1446" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr13.cc glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1446" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1446" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr13 glr-regr13.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr13 glr-regr13.cc $LIBS" "glr-regression.at:1446" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr13 glr-regr13.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: \$PREPARSER ./glr-regr13" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr13" "glr-regression.at:1446" ( $at_check_trace; $PREPARSER ./glr-regr13 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "defstate_init <- empty string: yychar=YYEMPTY nondefstate <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_look <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_shift <- nondefstate defstate_look 'a': yychar=YYEMPTY start <- defstate_init defstate_shift 'b': yychar=YYEMPTY " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1446: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1446" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1446" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_754 #AT_START_755 at_fn_group_banner 755 'glr-regression.at:1447' \ "Incorrect lookahead during deterministic GLR: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "755. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr13.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Tests: - Defaulted state with initial yychar: yychar == YYEMPTY. - Nondefaulted state: yychar != YYEMPTY. - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - User action changing the lookahead. */ %code { #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static void print_lookahead (yy::parser::symbol_type yylookahead, char const *reduction); #define PRINT_LOOKAHEAD(Msg) \ print_lookahead (yyla, Msg) #define USE(value) } %define parse.assert %define parse.trace %locations %glr-parser %skeleton "glr2.cc" %union { char value; } %type 'a' 'b' %% start: defstate_init defstate_shift 'b' change_lookahead 'a' { USE ($3); PRINT_LOOKAHEAD ("start <- defstate_init defstate_shift 'b'"); } ; defstate_init: %empty { PRINT_LOOKAHEAD ("defstate_init <- empty string"); } ; defstate_shift: nondefstate defstate_look 'a' { USE ($3); PRINT_LOOKAHEAD ("defstate_shift <- nondefstate defstate_look 'a'"); } ; defstate_look: %empty { PRINT_LOOKAHEAD ("defstate_look <- empty string"); } ; nondefstate: %empty { PRINT_LOOKAHEAD ("nondefstate <- empty string"); } | 'b' { USE ($1); PRINT_LOOKAHEAD ("nondefstate <- 'b'"); } ; change_lookahead: %empty { yytoken = yy::parser::yytranslate_ ('a'); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } static void print_lookahead (yy::parser::symbol_type yylookahead, char const *reduction) { // We use -2 and 0 to avoid this warning: // // glr-regr13.y:114:53: error: enumeral and non-enumeral type in conditional expression [-Werror=extra] // 114 | : yytoken == yy::parser::symbol_kind::S_YYEOF ? yy::parser::token::YYEOF // | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ // 115 | : yytoken == yy::parser::yytranslate_ ('a') ? 'a' // | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 116 | : yytoken == yy::parser::yytranslate_ ('b') ? 'b' // | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 117 | : '?'; // | ~~~~~ int yytoken = yylookahead.kind (); int yychr = yytoken == yy::parser::symbol_kind::S_YYEMPTY ? -2 : yytoken == yy::parser::symbol_kind::S_YYEOF ? 0 : yytoken == yy::parser::symbol_kind::S_3_a_ ? 'a' : yytoken == yy::parser::symbol_kind::S_4_b_ ? 'b' : '?'; printf ("%s:\n yychar=", reduction); if (yychr == yy::parser::token::YYEMPTY) printf ("YYEMPTY"); else if (yychr == yy::parser::token::YYEOF) printf ("YYEOF"); else { printf ("'%c', yylval='", yychr); if (yylookahead.value.value > ' ') printf ("%c", yylookahead.value.value); printf ("', yylloc=(%d,%d),(%d,%d)", yylookahead.location.begin.line, yylookahead.location.begin.column, yylookahead.location.end.line, yylookahead.location.end.column); } printf ("\n"); } #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "ab"; static int toknum = 0; int res; (void) lvalp;(void) llocp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; (*lvalp).value = YY_CAST (char, res + 'A' - 'a'); (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum; return res; } int main (void) { if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr13.cc glr-regr13.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1447" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr13.cc glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.cc glr-regr13.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.cc glr-regr13.y" "glr-regression.at:1447" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr13.cc glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1447" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1447" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1447" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr13.cc glr-regr13.y" at_fn_check_prepare_trace "glr-regression.at:1447" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr13.cc glr-regr13.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1447" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1447" printf "%s\n" "glr-regression.at:1447" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1447" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr13 glr-regr13.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr13 glr-regr13.cc $LIBS" "glr-regression.at:1447" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr13 glr-regr13.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: \$PREPARSER ./glr-regr13" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr13" "glr-regression.at:1447" ( $at_check_trace; $PREPARSER ./glr-regr13 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "defstate_init <- empty string: yychar=YYEMPTY nondefstate <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_look <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_shift <- nondefstate defstate_look 'a': yychar=YYEMPTY start <- defstate_init defstate_shift 'b': yychar=YYEMPTY " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1447: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1447" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1447" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_755 #AT_START_756 at_fn_group_banner 756 'glr-regression.at:1678' \ "Incorrect lookahead during nondeterministic GLR: glr.c" "" 33 at_xfail=no ( printf "%s\n" "756. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr14.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Tests: - Conflicting actions (split-off parse, which copies lookahead need, which is necessarily yytrue) and nonconflicting actions (non-split-off parse) for nondefaulted state: yychar != YYEMPTY. - Merged deferred actions (lookahead need and RHS from different stack than the target state) and nonmerged deferred actions (same stack). - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has seen the lookahead but current stack has not). - Exceeding stack capacity (stack explosion), and thus reallocating lookahead need array. Note that it does not seem possible to see the initial yychar value during nondeterministic operation since: - In order to preserve the initial yychar, only defaulted states may be entered. - If only defaulted states are entered, there are no conflicts, so nondeterministic operation does not start. */ %define parse.assert %define parse.trace %type 'a' 'b' 'c' 'd' stack_explosion %glr-parser %expect 0 %expect-rr 5 %skeleton "glr.c" %locations %union { char value; } %code { #include #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static void print_lookahead (int yychr, YYSTYPE *yylvalp, YYLTYPE *yyllocp, char const *reduction); #define PRINT_LOOKAHEAD(Msg) \ print_lookahead (yychar, &yylval, &yylloc, Msg) static char merge (YYSTYPE, YYSTYPE); #define USE(value) } %% start: merge 'c' stack_explosion { USE ($2); USE ($3); PRINT_LOOKAHEAD ("start <- merge 'c' stack_explosion"); } ; /* When merging the 2 deferred actions, the lookahead needs are different. */ merge: nonconflict1 'a' 'b' nonconflict2 %dprec 1 { USE ($2); USE ($3); PRINT_LOOKAHEAD ("merge <- nonconflict1 'a' 'b' nonconflict2"); } | conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 { USE ($3); USE ($5); PRINT_LOOKAHEAD ("merge <- conflict defstate_look 'a' nonconflict2 'b'" " defstate_shift"); } ; nonconflict1: %empty { PRINT_LOOKAHEAD ("nonconflict1 <- empty string"); } ; nonconflict2: %empty { PRINT_LOOKAHEAD ("nonconflict2 <- empty string"); } | 'a' { USE ($1); PRINT_LOOKAHEAD ("nonconflict2 <- 'a'"); } ; conflict: %empty { PRINT_LOOKAHEAD ("conflict <- empty string"); } ; defstate_look: %empty { PRINT_LOOKAHEAD ("defstate_look <- empty string"); } ; /* yychar != YYEMPTY but lookahead need is yyfalse. */ defstate_shift: %empty { PRINT_LOOKAHEAD ("defstate_shift <- empty string"); } ; stack_explosion: %empty { $$ = '\0'; } | alt1 stack_explosion %merge { $$ = $2; } | alt2 stack_explosion %merge { $$ = $2; } | alt3 stack_explosion %merge { $$ = $2; } ; alt1: 'd' no_look { USE ($1); if (yychar != 'd' && yychar != YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; alt2: 'd' no_look { USE ($1); if (yychar != 'd' && yychar != YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; alt3: 'd' no_look { USE ($1); if (yychar != 'd' && yychar != YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; no_look: %empty { if (yychar != YYEMPTY) PRINT_LOOKAHEAD ("Found lookahead where shouldn't during stack explosion."); } ; %% # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { LOCATION_PRINT (stderr, (yylloc)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } static void print_lookahead (int yychr, YYSTYPE *yylvalp, YYLTYPE *yyllocp, char const *reduction) { printf ("%s:\n yychar=", reduction); if (yychr == YYEMPTY) printf ("YYEMPTY"); else if (yychr == YYEOF) printf ("YYEOF"); else { printf ("'%c', yylval='", yychr); if (yylvalp->value > ' ') printf ("%c", yylvalp->value); printf ("', yylloc=(%d,%d),(%d,%d)", yyllocp->first_line, yyllocp->first_column, yyllocp->last_line, yyllocp->last_column); } printf ("\n"); } int yylex (void) { static char const input[] = "abcdddd"; static int toknum = 0; assert (toknum < YY_CAST (int, sizeof input)); (yylloc).first_line = (yylloc).last_line = 1; (yylloc).first_column = (yylloc).last_column = toknum + 1; (yylval).value = YY_CAST (char, input[toknum] + 'A' - 'a'); return input[toknum++]; } static char merge (YYSTYPE s1, YYSTYPE s2) { return YY_CAST (char, s1.value + s2.value); } int main (void) { yychar = '#'; /* Not a token in the grammar. */ yylval.value = '!'; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr14.c glr-regr14.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1678" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr14.c glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.c glr-regr14.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.c glr-regr14.y" "glr-regression.at:1678" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.c glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1678" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1678" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1678" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr14.c glr-regr14.y" at_fn_check_prepare_trace "glr-regression.at:1678" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr14.c glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1678" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1678" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr14 glr-regr14.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr14 glr-regr14.c $LIBS" "glr-regression.at:1678" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr14 glr-regr14.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: \$PREPARSER ./glr-regr14" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr14" "glr-regression.at:1678" ( $at_check_trace; $PREPARSER ./glr-regr14 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "conflict <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_look <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) nonconflict2 <- empty string: yychar='b', yylval='B', yylloc=(1,2),(1,2) defstate_shift <- empty string: yychar=YYEMPTY merge <- conflict defstate_look 'a' nonconflict2 'b' defstate_shift: yychar=YYEMPTY start <- merge 'c' stack_explosion: yychar=YYEOF " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1678: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1678" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1678" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_756 #AT_START_757 at_fn_group_banner 757 'glr-regression.at:1679' \ "Incorrect lookahead during nondeterministic GLR: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "757. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr14.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Tests: - Conflicting actions (split-off parse, which copies lookahead need, which is necessarily yytrue) and nonconflicting actions (non-split-off parse) for nondefaulted state: yychar != YYEMPTY. - Merged deferred actions (lookahead need and RHS from different stack than the target state) and nonmerged deferred actions (same stack). - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has seen the lookahead but current stack has not). - Exceeding stack capacity (stack explosion), and thus reallocating lookahead need array. Note that it does not seem possible to see the initial yychar value during nondeterministic operation since: - In order to preserve the initial yychar, only defaulted states may be entered. - If only defaulted states are entered, there are no conflicts, so nondeterministic operation does not start. */ %define parse.assert %define parse.trace %type 'a' 'b' 'c' 'd' stack_explosion %glr-parser %expect 0 %expect-rr 5 %skeleton "glr.cc" %locations %union { char value; } %code { #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static void print_lookahead (int yychr, yy::parser::value_type *yylvalp, yy::parser::location_type *yyllocp, char const *reduction); #define PRINT_LOOKAHEAD(Msg) \ print_lookahead (yychar, &yylval, &yylloc, Msg) static char merge (yy::parser::value_type, yy::parser::value_type); #define USE(value) } %% start: merge 'c' stack_explosion { USE ($2); USE ($3); PRINT_LOOKAHEAD ("start <- merge 'c' stack_explosion"); } ; /* When merging the 2 deferred actions, the lookahead needs are different. */ merge: nonconflict1 'a' 'b' nonconflict2 %dprec 1 { USE ($2); USE ($3); PRINT_LOOKAHEAD ("merge <- nonconflict1 'a' 'b' nonconflict2"); } | conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 { USE ($3); USE ($5); PRINT_LOOKAHEAD ("merge <- conflict defstate_look 'a' nonconflict2 'b'" " defstate_shift"); } ; nonconflict1: %empty { PRINT_LOOKAHEAD ("nonconflict1 <- empty string"); } ; nonconflict2: %empty { PRINT_LOOKAHEAD ("nonconflict2 <- empty string"); } | 'a' { USE ($1); PRINT_LOOKAHEAD ("nonconflict2 <- 'a'"); } ; conflict: %empty { PRINT_LOOKAHEAD ("conflict <- empty string"); } ; defstate_look: %empty { PRINT_LOOKAHEAD ("defstate_look <- empty string"); } ; /* yychar != YYEMPTY but lookahead need is yyfalse. */ defstate_shift: %empty { PRINT_LOOKAHEAD ("defstate_shift <- empty string"); } ; stack_explosion: %empty { $$ = '\0'; } | alt1 stack_explosion %merge { $$ = $2; } | alt2 stack_explosion %merge { $$ = $2; } | alt3 stack_explosion %merge { $$ = $2; } ; alt1: 'd' no_look { USE ($1); if (yychar != 'd' && yychar != YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; alt2: 'd' no_look { USE ($1); if (yychar != 'd' && yychar != YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; alt3: 'd' no_look { USE ($1); if (yychar != 'd' && yychar != YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; no_look: %empty { if (yychar != YYEMPTY) PRINT_LOOKAHEAD ("Found lookahead where shouldn't during stack explosion."); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } static void print_lookahead (int yychr, yy::parser::value_type *yylvalp, yy::parser::location_type *yyllocp, char const *reduction) { printf ("%s:\n yychar=", reduction); if (yychr == yy::parser::token::YYEMPTY) printf ("YYEMPTY"); else if (yychr == yy::parser::token::YYEOF) printf ("YYEOF"); else { printf ("'%c', yylval='", yychr); if (yylvalp->value > ' ') printf ("%c", yylvalp->value); printf ("', yylloc=(%d,%d),(%d,%d)", yyllocp->begin.line, yyllocp->begin.column, yyllocp->end.line, yyllocp->end.column); } printf ("\n"); } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { (void) lvalp;(void) llocp; static char const input[] = "abcdddd"; static int toknum = 0; assert (toknum < YY_CAST (int, sizeof input)); (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum + 1; (*lvalp).value = YY_CAST (char, input[toknum] + 'A' - 'a'); return input[toknum++]; } static char merge (yy::parser::value_type s1, yy::parser::value_type s2) { return YY_CAST (char, s1.value + s2.value); } int main (void) { if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr14.cc glr-regr14.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1679" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr14.cc glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.cc glr-regr14.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.cc glr-regr14.y" "glr-regression.at:1679" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.cc glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1679" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1679" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1679" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr14.cc glr-regr14.y" at_fn_check_prepare_trace "glr-regression.at:1679" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr14.cc glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1679" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1679" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr14 glr-regr14.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr14 glr-regr14.cc $LIBS" "glr-regression.at:1679" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr14 glr-regr14.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: \$PREPARSER ./glr-regr14" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr14" "glr-regression.at:1679" ( $at_check_trace; $PREPARSER ./glr-regr14 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "conflict <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_look <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) nonconflict2 <- empty string: yychar='b', yylval='B', yylloc=(1,2),(1,2) defstate_shift <- empty string: yychar=YYEMPTY merge <- conflict defstate_look 'a' nonconflict2 'b' defstate_shift: yychar=YYEMPTY start <- merge 'c' stack_explosion: yychar=YYEOF " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1679: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1679" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1679" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_757 #AT_START_758 at_fn_group_banner 758 'glr-regression.at:1680' \ "Incorrect lookahead during nondeterministic GLR: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "758. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr14.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } /* Tests: - Conflicting actions (split-off parse, which copies lookahead need, which is necessarily yytrue) and nonconflicting actions (non-split-off parse) for nondefaulted state: yychar != YYEMPTY. - Merged deferred actions (lookahead need and RHS from different stack than the target state) and nonmerged deferred actions (same stack). - Defaulted state after lookahead: yychar != YYEMPTY. - Defaulted state after shift: yychar == YYEMPTY. - yychar != YYEMPTY but lookahead need is yyfalse (a previous stack has seen the lookahead but current stack has not). - Exceeding stack capacity (stack explosion), and thus reallocating lookahead need array. Note that it does not seem possible to see the initial yychar value during nondeterministic operation since: - In order to preserve the initial yychar, only defaulted states may be entered. - If only defaulted states are entered, there are no conflicts, so nondeterministic operation does not start. */ %define parse.assert %define parse.trace %type 'a' 'b' 'c' 'd' stack_explosion %glr-parser %expect 0 %expect-rr 5 %skeleton "glr2.cc" %locations %union { char value; } %code { #include static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); static void print_lookahead (yy::parser::symbol_type yylookahead, char const *reduction); #define PRINT_LOOKAHEAD(Msg) \ print_lookahead (yyla, Msg) static char merge (yy::parser::value_type, yy::parser::value_type); #define USE(value) } %% start: merge 'c' stack_explosion { USE ($2); USE ($3); PRINT_LOOKAHEAD ("start <- merge 'c' stack_explosion"); } ; /* When merging the 2 deferred actions, the lookahead needs are different. */ merge: nonconflict1 'a' 'b' nonconflict2 %dprec 1 { USE ($2); USE ($3); PRINT_LOOKAHEAD ("merge <- nonconflict1 'a' 'b' nonconflict2"); } | conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 { USE ($3); USE ($5); PRINT_LOOKAHEAD ("merge <- conflict defstate_look 'a' nonconflict2 'b'" " defstate_shift"); } ; nonconflict1: %empty { PRINT_LOOKAHEAD ("nonconflict1 <- empty string"); } ; nonconflict2: %empty { PRINT_LOOKAHEAD ("nonconflict2 <- empty string"); } | 'a' { USE ($1); PRINT_LOOKAHEAD ("nonconflict2 <- 'a'"); } ; conflict: %empty { PRINT_LOOKAHEAD ("conflict <- empty string"); } ; defstate_look: %empty { PRINT_LOOKAHEAD ("defstate_look <- empty string"); } ; /* yychar != YYEMPTY but lookahead need is yyfalse. */ defstate_shift: %empty { PRINT_LOOKAHEAD ("defstate_shift <- empty string"); } ; stack_explosion: %empty { $$ = '\0'; } | alt1 stack_explosion %merge { $$ = $2; } | alt2 stack_explosion %merge { $$ = $2; } | alt3 stack_explosion %merge { $$ = $2; } ; alt1: 'd' no_look { USE ($1); if (yytoken != yy::parser::yytranslate_ ('d') && yytoken != symbol_kind::S_YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; alt2: 'd' no_look { USE ($1); if (yytoken != yy::parser::yytranslate_ ('d') && yytoken != symbol_kind::S_YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; alt3: 'd' no_look { USE ($1); if (yytoken != yy::parser::yytranslate_ ('d') && yytoken != symbol_kind::S_YYEOF) PRINT_LOOKAHEAD ("Incorrect lookahead during stack explosion."); } ; no_look: %empty { if (yytoken != symbol_kind::S_YYEMPTY) PRINT_LOOKAHEAD ("Found lookahead where shouldn't during stack explosion."); } ; %% /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } static void print_lookahead (yy::parser::symbol_type yylookahead, char const *reduction) { // We use -2 and 0 to avoid this warning: // // glr-regr13.y:114:53: error: enumeral and non-enumeral type in conditional expression [-Werror=extra] // 114 | : yytoken == yy::parser::symbol_kind::S_YYEOF ? yy::parser::token::YYEOF // | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ // 115 | : yytoken == yy::parser::yytranslate_ ('a') ? 'a' // | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 116 | : yytoken == yy::parser::yytranslate_ ('b') ? 'b' // | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 117 | : '?'; // | ~~~~~ int yytoken = yylookahead.kind (); int yychr = yytoken == yy::parser::symbol_kind::S_YYEMPTY ? -2 : yytoken == yy::parser::symbol_kind::S_YYEOF ? 0 : yytoken == yy::parser::symbol_kind::S_3_a_ ? 'a' : yytoken == yy::parser::symbol_kind::S_4_b_ ? 'b' : '?'; printf ("%s:\n yychar=", reduction); if (yychr == yy::parser::token::YYEMPTY) printf ("YYEMPTY"); else if (yychr == yy::parser::token::YYEOF) printf ("YYEOF"); else { printf ("'%c', yylval='", yychr); if (yylookahead.value.value > ' ') printf ("%c", yylookahead.value.value); printf ("', yylloc=(%d,%d),(%d,%d)", yylookahead.location.begin.line, yylookahead.location.begin.column, yylookahead.location.end.line, yylookahead.location.end.column); } printf ("\n"); } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { (void) lvalp;(void) llocp; static char const input[] = "abcdddd"; static int toknum = 0; assert (toknum < YY_CAST (int, sizeof input)); (*llocp).begin.line = (*llocp).end.line = 1; (*llocp).begin.column = (*llocp).end.column = toknum + 1; (*lvalp).value = YY_CAST (char, input[toknum] + 'A' - 'a'); return input[toknum++]; } static char merge (yy::parser::value_type s1, yy::parser::value_type s2) { return YY_CAST (char, s1.value + s2.value); } int main (void) { if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr14.cc glr-regr14.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1680" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr14.cc glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.cc glr-regr14.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.cc glr-regr14.y" "glr-regression.at:1680" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr14.cc glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1680" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1680" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1680" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr14.cc glr-regr14.y" at_fn_check_prepare_trace "glr-regression.at:1680" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr14.cc glr-regr14.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1680" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1680" printf "%s\n" "glr-regression.at:1680" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1680" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr14 glr-regr14.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr14 glr-regr14.cc $LIBS" "glr-regression.at:1680" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr14 glr-regr14.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: \$PREPARSER ./glr-regr14" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr14" "glr-regression.at:1680" ( $at_check_trace; $PREPARSER ./glr-regr14 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "conflict <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) defstate_look <- empty string: yychar='a', yylval='A', yylloc=(1,1),(1,1) nonconflict2 <- empty string: yychar='b', yylval='B', yylloc=(1,2),(1,2) defstate_shift <- empty string: yychar=YYEMPTY merge <- conflict defstate_look 'a' nonconflict2 'b' defstate_shift: yychar=YYEMPTY start <- merge 'c' stack_explosion: yychar=YYEOF " | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1680: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1680" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1680" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_758 #AT_START_759 at_fn_group_banner 759 'glr-regression.at:1785' \ "Leaked semantic values when reporting ambiguity: glr.c" "" 33 at_xfail=no ( printf "%s\n" "759. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr15.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 2 %skeleton "glr.c" %destructor { parent_rhs_before_value = 0; } parent_rhs_before %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static int parent_rhs_before_value = 0; # define USE(val) } %% start: alt1 %dprec 1 | alt2 %dprec 2 ; /* This stack must be merged into the other stacks *last* (added at the beginning of the semantic options list) so that yyparse will choose to clean it up rather than the tree for which some semantic actions have been performed. Thus, if yyreportAmbiguity longjmp's to yyparse, the values from those other trees are not cleaned up. */ alt1: ; alt2: parent_rhs_before ambiguity { USE ($1); parent_rhs_before_value = 0; } ; parent_rhs_before: { USE ($$); parent_rhs_before_value = 1; } ; ambiguity: ambiguity1 | ambiguity2 ; ambiguity1: ; ambiguity2: ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse () != 1; if (parent_rhs_before_value) { fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr15.c glr-regr15.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr15.c glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.c glr-regr15.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.c glr-regr15.y" "glr-regression.at:1785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.c glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1785" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1785" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1785" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr15.c glr-regr15.y" at_fn_check_prepare_trace "glr-regression.at:1785" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr15.c glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1785" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1785" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr15 glr-regr15.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr15 glr-regr15.c $LIBS" "glr-regression.at:1785" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr15 glr-regr15.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: \$PREPARSER ./glr-regr15" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr15" "glr-regression.at:1785" ( $at_check_trace; $PREPARSER ./glr-regr15 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1785: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1785" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, ambiguity -> ambiguity1 -> Option 2, ambiguity -> ambiguity2 -> syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1785" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_759 #AT_START_760 at_fn_group_banner 760 'glr-regression.at:1786' \ "Leaked semantic values when reporting ambiguity: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "760. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr15.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 2 %skeleton "glr.cc" %destructor { parent_rhs_before_value = 0; } parent_rhs_before %code { static int yylex (yy::parser::value_type *lvalp); static int parent_rhs_before_value = 0; # define USE(val) } %% start: alt1 %dprec 1 | alt2 %dprec 2 ; /* This stack must be merged into the other stacks *last* (added at the beginning of the semantic options list) so that yyparse will choose to clean it up rather than the tree for which some semantic actions have been performed. Thus, if yyreportAmbiguity longjmp's to yyparse, the values from those other trees are not cleaned up. */ alt1: ; alt2: parent_rhs_before ambiguity { USE ($1); parent_rhs_before_value = 0; } ; parent_rhs_before: { USE ($$); parent_rhs_before_value = 1; } ; ambiguity: ambiguity1 | ambiguity2 ; ambiguity1: ; ambiguity2: ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse () != 1; if (parent_rhs_before_value) { fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr15.cc glr-regr15.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr15.cc glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.cc glr-regr15.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.cc glr-regr15.y" "glr-regression.at:1786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.cc glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1786" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1786" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1786" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr15.cc glr-regr15.y" at_fn_check_prepare_trace "glr-regression.at:1786" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr15.cc glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1786" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1786" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr15 glr-regr15.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr15 glr-regr15.cc $LIBS" "glr-regression.at:1786" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr15 glr-regr15.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: \$PREPARSER ./glr-regr15" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr15" "glr-regression.at:1786" ( $at_check_trace; $PREPARSER ./glr-regr15 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1786: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1786" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, ambiguity -> ambiguity1 -> Option 2, ambiguity -> ambiguity2 -> syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1786" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_760 #AT_START_761 at_fn_group_banner 761 'glr-regression.at:1787' \ "Leaked semantic values when reporting ambiguity: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "761. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr15.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 2 %skeleton "glr2.cc" %destructor { parent_rhs_before_value = 0; } parent_rhs_before %code { static int yylex (yy::parser::value_type *lvalp); static int parent_rhs_before_value = 0; # define USE(val) } %% start: alt1 %dprec 1 | alt2 %dprec 2 ; /* This stack must be merged into the other stacks *last* (added at the beginning of the semantic options list) so that yyparse will choose to clean it up rather than the tree for which some semantic actions have been performed. Thus, if yyreportAmbiguity longjmp's to yyparse, the values from those other trees are not cleaned up. */ alt1: ; alt2: parent_rhs_before ambiguity { USE ($1); parent_rhs_before_value = 0; } ; parent_rhs_before: { USE ($$); parent_rhs_before_value = 1; } ; ambiguity: ambiguity1 | ambiguity2 ; ambiguity1: ; ambiguity2: ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse () != 1; if (parent_rhs_before_value) { fprintf (stderr, "'parent_rhs_before' destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr15.cc glr-regr15.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1787" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr15.cc glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.cc glr-regr15.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.cc glr-regr15.y" "glr-regression.at:1787" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr15.cc glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1787" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1787" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1787" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr15.cc glr-regr15.y" at_fn_check_prepare_trace "glr-regression.at:1787" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr15.cc glr-regr15.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1787" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1787" printf "%s\n" "glr-regression.at:1787" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1787" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr15 glr-regr15.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr15 glr-regr15.cc $LIBS" "glr-regression.at:1787" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr15 glr-regr15.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: \$PREPARSER ./glr-regr15" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr15" "glr-regression.at:1787" ( $at_check_trace; $PREPARSER ./glr-regr15 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1787: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1787" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, ambiguity -> ambiguity1 -> Option 2, ambiguity -> ambiguity2 -> syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1787" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_761 #AT_START_762 at_fn_group_banner 762 'glr-regression.at:1860' \ "Leaked lookahead after nondeterministic parse syntax error: glr.c" "" 33 at_xfail=no ( printf "%s\n" "762. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr16.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 1 %skeleton "glr.c" %destructor { lookahead_value = 0; } 'b' %code { # include #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); static int lookahead_value = 0; # define USE(val) } %% start: alt1 'a' | alt2 'a' ; alt1: ; alt2: ; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "ab"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 'b') lookahead_value = 1; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse () != 1; if (lookahead_value) { fprintf (stderr, "Lookahead destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr16.c glr-regr16.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1860" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr16.c glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.c glr-regr16.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.c glr-regr16.y" "glr-regression.at:1860" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.c glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1860" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1860" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1860" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr16.c glr-regr16.y" at_fn_check_prepare_trace "glr-regression.at:1860" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr16.c glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1860" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1860" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr16 glr-regr16.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr16 glr-regr16.c $LIBS" "glr-regression.at:1860" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr16 glr-regr16.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: \$PREPARSER ./glr-regr16" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr16" "glr-regression.at:1860" ( $at_check_trace; $PREPARSER ./glr-regr16 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1860: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1860" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1860" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_762 #AT_START_763 at_fn_group_banner 763 'glr-regression.at:1861' \ "Leaked lookahead after nondeterministic parse syntax error: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "763. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr16.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 1 %skeleton "glr.cc" %destructor { lookahead_value = 0; } 'b' %code { # include static int yylex (yy::parser::value_type *lvalp); static int lookahead_value = 0; # define USE(val) } %% start: alt1 'a' | alt2 'a' ; alt1: ; alt2: ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "ab"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 'b') lookahead_value = 1; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse () != 1; if (lookahead_value) { fprintf (stderr, "Lookahead destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr16.cc glr-regr16.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr16.cc glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.cc glr-regr16.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.cc glr-regr16.y" "glr-regression.at:1861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.cc glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1861" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1861" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1861" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr16.cc glr-regr16.y" at_fn_check_prepare_trace "glr-regression.at:1861" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr16.cc glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1861" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1861" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr16 glr-regr16.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr16 glr-regr16.cc $LIBS" "glr-regression.at:1861" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr16 glr-regr16.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: \$PREPARSER ./glr-regr16" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr16" "glr-regression.at:1861" ( $at_check_trace; $PREPARSER ./glr-regr16 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1861: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1861" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1861" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_763 #AT_START_764 at_fn_group_banner 764 'glr-regression.at:1862' \ "Leaked lookahead after nondeterministic parse syntax error: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "764. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr16.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 1 %skeleton "glr2.cc" %destructor { lookahead_value = 0; } 'b' %code { # include static int yylex (yy::parser::value_type *lvalp); static int lookahead_value = 0; # define USE(val) } %% start: alt1 'a' | alt2 'a' ; alt1: ; alt2: ; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "ab"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; if (res == 'b') lookahead_value = 1; return res; } int main (void) { int status; if (getenv ("YYDEBUG")) yydebug = 1; status = yyparse () != 1; if (lookahead_value) { fprintf (stderr, "Lookahead destructor not called.\n"); status = 1; } return status; } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr16.cc glr-regr16.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1862" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr16.cc glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.cc glr-regr16.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.cc glr-regr16.y" "glr-regression.at:1862" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr16.cc glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1862" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1862" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1862" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr16.cc glr-regr16.y" at_fn_check_prepare_trace "glr-regression.at:1862" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr16.cc glr-regr16.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1862" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1862" printf "%s\n" "glr-regression.at:1862" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1862" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr16 glr-regr16.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr16 glr-regr16.cc $LIBS" "glr-regression.at:1862" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr16 glr-regr16.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: \$PREPARSER ./glr-regr16" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr16" "glr-regression.at:1862" ( $at_check_trace; $PREPARSER ./glr-regr16 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1862: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1862" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1862" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_764 #AT_START_765 at_fn_group_banner 765 'glr-regression.at:1964' \ "Uninitialized location when reporting ambiguity: glr.c api.pure" "" 33 at_xfail=no ( printf "%s\n" "765. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr17.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 3 %skeleton "glr.c" %define api.pure %locations %define parse.error verbose %union { int dummy; } %code { #include #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL static int location_print (FILE *yyo, YYLTYPE const * const yylocp); # ifndef LOCATION_PRINT # define LOCATION_PRINT(File, Loc) location_print (File, &(Loc)) # endif #endif /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg); static int yylex (YYSTYPE *lvalp, YYLTYPE *llocp); } %% /* Tests the case of an empty RHS that has inherited the location of the previous nonterminal, which is unresolved. That location is reported as the last position of the ambiguity. */ start: ambig1 empty1 | ambig2 empty2 ; /* Tests multiple levels of yyresolveLocations recursion. */ ambig1: sub_ambig1 | sub_ambig2 ; ambig2: sub_ambig1 | sub_ambig2 ; /* Tests the case of a non-empty RHS as well as the case of an empty RHS that has inherited the initial location. The empty RHS's location is reported as the first position in the ambiguity. */ sub_ambig1: empty1 'a' 'b' ; sub_ambig2: empty2 'a' 'b' ; empty1: ; empty2: ; %% # include # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. */ __attribute__((__unused__)) static int location_print (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += fprintf (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += fprintf (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += fprintf (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += fprintf (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += fprintf (yyo, "-%d", end_col); } return res; } #endif /* A C error reporting function. */ /* !POSIX */ static void yyerror (YYLTYPE const * const llocp, const char *msg) { LOCATION_PRINT (stderr, (*llocp)); fprintf (stderr, ": "); fprintf (stderr, "%s\n", msg); } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp) { static char const input[] = "ab"; static int toknum = 0; (void) lvalp;(void) llocp; assert (toknum < YY_CAST (int, sizeof input)); lvalp->dummy = 0; (*llocp).first_line = (*llocp).last_line = 2; (*llocp).first_column = toknum + 1; (*llocp).last_column = (*llocp).first_column + 1; return input[toknum++]; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr17.c glr-regr17.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1964" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr17.c glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.c glr-regr17.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.c glr-regr17.y" "glr-regression.at:1964" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.c glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1964" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1964" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1964" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr17.c glr-regr17.y" at_fn_check_prepare_trace "glr-regression.at:1964" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr17.c glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1964" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1964" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o glr-regr17 glr-regr17.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr17 glr-regr17.c $LIBS" "glr-regression.at:1964" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o glr-regr17 glr-regr17.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: \$PREPARSER ./glr-regr17" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr17" "glr-regression.at:1964" ( $at_check_trace; $PREPARSER ./glr-regr17 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1964: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1964" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> ambig1 -> sub_ambig2 -> empty2 -> 'a' 'b' empty1 -> Option 2, start -> ambig2 -> sub_ambig2 -> empty2 -> 'a' 'b' empty2 -> 1.1-2.2: syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1964" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_765 #AT_START_766 at_fn_group_banner 766 'glr-regression.at:1965' \ "Uninitialized location when reporting ambiguity: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "766. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr17.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 3 %skeleton "glr.cc" %locations %define parse.error verbose %union { int dummy; } %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% /* Tests the case of an empty RHS that has inherited the location of the previous nonterminal, which is unresolved. That location is reported as the last position of the ambiguity. */ start: ambig1 empty1 | ambig2 empty2 ; /* Tests multiple levels of yyresolveLocations recursion. */ ambig1: sub_ambig1 | sub_ambig2 ; ambig2: sub_ambig1 | sub_ambig2 ; /* Tests the case of a non-empty RHS as well as the case of an empty RHS that has inherited the initial location. The empty RHS's location is reported as the first position in the ambiguity. */ sub_ambig1: empty1 'a' 'b' ; sub_ambig2: empty2 'a' 'b' ; empty1: ; empty2: ; %% # include /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "ab"; static int toknum = 0; (void) lvalp;(void) llocp; assert (toknum < YY_CAST (int, sizeof input)); lvalp->dummy = 0; (*llocp).begin.line = (*llocp).end.line = 2; (*llocp).begin.column = toknum + 1; (*llocp).end.column = (*llocp).begin.column + 1; return input[toknum++]; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr17.cc glr-regr17.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1965" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr17.cc glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.cc glr-regr17.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.cc glr-regr17.y" "glr-regression.at:1965" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.cc glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1965" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1965" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1965" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr17.cc glr-regr17.y" at_fn_check_prepare_trace "glr-regression.at:1965" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr17.cc glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1965" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1965" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr17 glr-regr17.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr17 glr-regr17.cc $LIBS" "glr-regression.at:1965" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o glr-regr17 glr-regr17.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: \$PREPARSER ./glr-regr17" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr17" "glr-regression.at:1965" ( $at_check_trace; $PREPARSER ./glr-regr17 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1965: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1965" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> ambig1 -> sub_ambig2 -> empty2 -> 'a' 'b' empty1 -> Option 2, start -> ambig2 -> sub_ambig2 -> empty2 -> 'a' 'b' empty2 -> 1.1-2.2: syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1965" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_766 #AT_START_767 at_fn_group_banner 767 'glr-regression.at:1966' \ "Uninitialized location when reporting ambiguity: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "767. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr17.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %expect 0 %expect-rr 3 %skeleton "glr2.cc" %locations %define parse.error verbose %union { int dummy; } %code { static int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp); } %% /* Tests the case of an empty RHS that has inherited the location of the previous nonterminal, which is unresolved. That location is reported as the last position of the ambiguity. */ start: ambig1 empty1 | ambig2 empty2 ; /* Tests multiple levels of yyresolveLocations recursion. */ ambig1: sub_ambig1 | sub_ambig2 ; ambig2: sub_ambig1 | sub_ambig2 ; /* Tests the case of a non-empty RHS as well as the case of an empty RHS that has inherited the initial location. The empty RHS's location is reported as the first position in the ambiguity. */ sub_ambig1: empty1 'a' 'b' ; sub_ambig2: empty2 'a' 'b' ; empty1: ; empty2: ; %% # include /* A C++ error reporting function. */ void yy::parser::error (const location_type& l, const std::string& m) { std::cerr << l << ": " << m << '\n'; } int yylex (yy::parser::value_type *lvalp, yy::parser::location_type *llocp) { static char const input[] = "ab"; static int toknum = 0; (void) lvalp;(void) llocp; assert (toknum < YY_CAST (int, sizeof input)); lvalp->dummy = 0; (*llocp).begin.line = (*llocp).end.line = 2; (*llocp).begin.column = toknum + 1; (*llocp).end.column = (*llocp).begin.column + 1; return input[toknum++]; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -rall -o glr-regr17.cc glr-regr17.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:1966" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -rall -o glr-regr17.cc glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.cc glr-regr17.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.cc glr-regr17.y" "glr-regression.at:1966" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -rall -o glr-regr17.cc glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1966" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:1966" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:1966" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr17.cc glr-regr17.y" at_fn_check_prepare_trace "glr-regression.at:1966" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -rall -o glr-regr17.cc glr-regr17.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:1966" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1966" printf "%s\n" "glr-regression.at:1966" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:1966" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o glr-regr17 glr-regr17.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr17 glr-regr17.cc $LIBS" "glr-regression.at:1966" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o glr-regr17 glr-regr17.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: \$PREPARSER ./glr-regr17" at_fn_check_prepare_dynamic " $PREPARSER ./glr-regr17" "glr-regression.at:1966" ( $at_check_trace; $PREPARSER ./glr-regr17 ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:1966: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:1966" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Ambiguity detected. Option 1, start -> ambig1 -> sub_ambig2 -> empty2 -> 'a' 'b' empty1 -> Option 2, start -> ambig2 -> sub_ambig2 -> empty2 -> 'a' 'b' empty2 -> 1.1-2.2: syntax is ambiguous " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:1966" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_767 #AT_START_768 at_fn_group_banner 768 'glr-regression.at:2035' \ "Missed %merge type warnings when LHS type is declared later: glr.c" "" 33 at_xfail=no ( printf "%s\n" "768. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr18.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %skeleton "glr.c" %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %union { int type1; int type2; int type3; } %% sym1: sym2 %merge { $$ = $1; } ; sym2: sym3 %merge { $$ = $1; } ; sym3: %merge { $$ = 0; } ; %type sym1; %type sym2; %type sym3; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = ""; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { (void) argc; (void) argv; return yyparse (); } _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2035: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y" "glr-regression.at:2035" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != 30 | sym2: sym3 %merge { \$\$ = \$1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { \$\$ = \$1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != 31 | sym3: %merge { \$\$ = 0; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { \$\$ = \$1; } ; | ^~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2035" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_768 #AT_START_769 at_fn_group_banner 769 'glr-regression.at:2036' \ "Missed %merge type warnings when LHS type is declared later: glr.cc" "" 33 at_xfail=no ( printf "%s\n" "769. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr18.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %skeleton "glr.cc" %code { static int yylex (yy::parser::value_type *lvalp); } %union { int type1; int type2; int type3; } // In C++ we need one more line for the line numbers to match. %% sym1: sym2 %merge { $$ = $1; } ; sym2: sym3 %merge { $$ = $1; } ; sym3: %merge { $$ = 0; } ; %type sym1; %type sym2; %type sym3; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2036: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y" "glr-regression.at:2036" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != 30 | sym2: sym3 %merge { \$\$ = \$1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { \$\$ = \$1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != 31 | sym3: %merge { \$\$ = 0; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { \$\$ = \$1; } ; | ^~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2036" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_769 #AT_START_770 at_fn_group_banner 770 'glr-regression.at:2037' \ "Missed %merge type warnings when LHS type is declared later: glr2.cc" "" 33 at_xfail=no ( printf "%s\n" "770. $at_setup_line: testing $at_desc ..." $at_traceon cat >glr-regr18.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %skeleton "glr2.cc" %code { static int yylex (yy::parser::value_type *lvalp); } %union { int type1; int type2; int type3; } // In C++ we need one more line for the line numbers to match. %% sym1: sym2 %merge { $$ = $1; } ; sym2: sym3 %merge { $$ = $1; } ; sym3: %merge { $$ = 0; } ; %type sym1; %type sym2; %type sym3; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = ""; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; (void) argc; (void) argv; return p.parse (); } _ATEOF { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2037: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y" "glr-regression.at:2037" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret -o glr-regr18.c -rall -fcaret glr-regr18.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "glr-regr18.y:30.18-24: error: result type clash on merge function 'merge': != 30 | sym2: sym3 %merge { \$\$ = \$1; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { \$\$ = \$1; } ; | ^~~~~~~ glr-regr18.y:31.13-19: error: result type clash on merge function 'merge': != 31 | sym3: %merge { \$\$ = 0; } ; | ^~~~~~~ glr-regr18.y:29.18-24: note: previous declaration 29 | sym1: sym2 %merge { \$\$ = \$1; } ; | ^~~~~~~ " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2037" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_770 #AT_START_771 at_fn_group_banner 771 'glr-regression.at:2149' \ "Ambiguity reports: glr.c" " " 33 at_xfail=no ( printf "%s\n" "771. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %define parse.assert %define parse.trace %debug %glr-parser %expect 0 %expect-rr 1 %skeleton "glr.c" %% start: 'a' b 'c' d | 'a' b 'c' d ; b: 'b'; d: %empty; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } #include static int yylex (void) { static char const input[] = "abc"; static int toknum = 0; int res; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include /* getenv. */ #include /* strcmp. */ int main (int argc, char const* argv[]) { yydebug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) yydebug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) yydebug |= 2; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:2149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "glr-regression.at:2149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2149" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:2149" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2149" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "glr-regression.at:2149" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:2149" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2149" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "glr-regression.at:2149" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "glr-regression.at:2149" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2149: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2149" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Reading a token Next token is token 'a' () Shifting token 'a' () Entering state 1 Reading a token Next token is token 'b' () Shifting token 'b' () Entering state 3 Reducing stack 0 by rule 3 (line 30): \$1 = token 'b' () -> \$\$ = nterm b () Entering state 4 Reading a token Next token is token 'c' () Shifting token 'c' () Entering state 6 Reducing stack 0 by rule 4 (line 31): -> \$\$ = nterm d () Entering state 7 Reading a token Now at end of input. Stack 0 Entering state 7 Now at end of input. Splitting off stack 1 from 0. Reduced stack 1 by rule 2 (line 28); action deferred. Now in state 2. Stack 1 Entering state 2 Now at end of input. Reduced stack 0 by rule 1 (line 27); action deferred. Now in state 2. Merging stack 0 into stack 1. Stack 1 Entering state 2 Now at end of input. Removing dead stacks. Rename stack 1 -> 0. On stack 0, shifting token \"end of file\" () Stack 0 now in state 5 Ambiguity detected. Option 1, start -> 'a' b 'c' d Option 2, start -> 'a' b 'c' d syntax is ambiguous Cleanup: popping token \"end of file\" () Cleanup: popping unresolved nterm start () Cleanup: popping nterm d () Cleanup: popping token 'c' () Cleanup: popping nterm b () Cleanup: popping token 'a' () " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2149" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_771 #AT_START_772 at_fn_group_banner 772 'glr-regression.at:2150' \ "Ambiguity reports: glr.cc" " " 33 at_xfail=no ( printf "%s\n" "772. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %debug %glr-parser %expect 0 %expect-rr 1 %skeleton "glr.cc" // In C++ we need two more lines for the line numbers in the trace to match. %% start: 'a' b 'c' d | 'a' b 'c' d ; b: 'b'; d: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "abc"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:2150" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "glr-regression.at:2150" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2150" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:2150" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2150" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "glr-regression.at:2150" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:2150" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2150" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "glr-regression.at:2150" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "glr-regression.at:2150" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2150: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2150" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Reading a token Next token is token 'a' () Shifting token 'a' () Entering state 1 Reading a token Next token is token 'b' () Shifting token 'b' () Entering state 3 Reducing stack 0 by rule 3 (line 30): \$1 = token 'b' () -> \$\$ = nterm b () Entering state 4 Reading a token Next token is token 'c' () Shifting token 'c' () Entering state 6 Reducing stack 0 by rule 4 (line 31): -> \$\$ = nterm d () Entering state 7 Reading a token Now at end of input. Stack 0 Entering state 7 Now at end of input. Splitting off stack 1 from 0. Reduced stack 1 by rule 2 (line 28); action deferred. Now in state 2. Stack 1 Entering state 2 Now at end of input. Reduced stack 0 by rule 1 (line 27); action deferred. Now in state 2. Merging stack 0 into stack 1. Stack 1 Entering state 2 Now at end of input. Removing dead stacks. Rename stack 1 -> 0. On stack 0, shifting token \"end of file\" () Stack 0 now in state 5 Ambiguity detected. Option 1, start -> 'a' b 'c' d Option 2, start -> 'a' b 'c' d syntax is ambiguous Cleanup: popping token \"end of file\" () Cleanup: popping unresolved nterm start () Cleanup: popping nterm d () Cleanup: popping token 'c' () Cleanup: popping nterm b () Cleanup: popping token 'a' () " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2150" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_772 #AT_START_773 at_fn_group_banner 773 'glr-regression.at:2151' \ "Ambiguity reports: glr2.cc" " " 33 at_xfail=no ( printf "%s\n" "773. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %code { static int yylex (yy::parser::value_type *lvalp); } %define parse.assert %define parse.trace %debug %glr-parser %expect 0 %expect-rr 1 %skeleton "glr2.cc" // In C++ we need two more lines for the line numbers in the trace to match. %% start: 'a' b 'c' d | 'a' b 'c' d ; b: 'b'; d: %empty; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } #include static int yylex (yy::parser::value_type *lvalp) { static char const input[] = "abc"; static int toknum = 0; int res; (void) lvalp; enum { input_elts = sizeof input / sizeof input[0] }; (void) input_elts; assert (0 <= toknum && toknum < input_elts); res = input[toknum++]; ; return res; } #include // getenv. #include // strcmp. int main (int argc, char const* argv[]) { yy::parser p; int debug = !!getenv ("YYDEBUG"); for (int i = 1; i < argc; ++i) if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) debug |= 1; else if (!strcmp (argv[i], "-s") || !strcmp (argv[i], "--stat")) debug |= 2; p.set_debug_level (debug); return p.parse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:2151" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "glr-regression.at:2151" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2151" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:2151" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2151" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "glr-regression.at:2151" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:2151" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2151" printf "%s\n" "glr-regression.at:2151" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2151" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "glr-regression.at:2151" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: \$PREPARSER ./input --debug" at_fn_check_prepare_dynamic " $PREPARSER ./input --debug" "glr-regression.at:2151" ( $at_check_trace; $PREPARSER ./input --debug ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2151: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2151" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "Starting parse Entering state 0 Reading a token Next token is token 'a' () Shifting token 'a' () Entering state 1 Reading a token Next token is token 'b' () Shifting token 'b' () Entering state 3 Reducing stack 0 by rule 3 (line 30): \$1 = token 'b' () -> \$\$ = nterm b () Entering state 4 Reading a token Next token is token 'c' () Shifting token 'c' () Entering state 6 Reducing stack 0 by rule 4 (line 31): -> \$\$ = nterm d () Entering state 7 Reading a token Now at end of input. Stack 0 Entering state 7 Now at end of input. Splitting off stack 1 from 0. Reduced stack 1 by rule 2 (line 28); action deferred. Now in state 2. Stack 1 Entering state 2 Now at end of input. Reduced stack 0 by rule 1 (line 27); action deferred. Now in state 2. Merging stack 0 into stack 1. Stack 1 Entering state 2 Now at end of input. Removing dead stacks. Rename stack 1 -> 0. On stack 0, shifting token \"end of file\" () Stack 0 now in state 5 Ambiguity detected. Option 1, start -> 'a' b 'c' d Option 2, start -> 'a' b 'c' d syntax is ambiguous Cleanup: popping token \"end of file\" () Cleanup: popping unresolved nterm start () Cleanup: popping nterm d () Cleanup: popping token 'c' () Cleanup: popping nterm b () Cleanup: popping token 'a' () " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2151" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_773 #AT_START_774 at_fn_group_banner 774 'glr-regression.at:2229' \ "Predicates: glr.c" " " 33 at_xfail=no ( printf "%s\n" "774. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %define parse.error verbose %expect-rr 1 %skeleton "glr.c" %code { #include #include bool new_syntax = false; const char *input = YY_NULLPTR; #include /* !POSIX */ static void yyerror (const char *msg); static int yylex (void); } %% widget: %? {new_syntax} 'w' id new_args { printf("new"); } | %?{!new_syntax} 'w' id old_args { printf("old"); } ; id: 'i'; new_args: 'n'; old_args: 'o'; %% /* A C error reporting function. */ /* !POSIX */ static void yyerror (const char *msg) { fprintf (stderr, "%s\n", msg); } int yylex (void) { return *input++; } int main (int argc, const char* argv[]) { assert (argc == 2); (void) argc; // First char decides whether new, or old syntax. // Then the input. new_syntax = argv[1][0] == 'N'; input = argv[1] + 1; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.c input.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:2229" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y" "glr-regression.at:2229" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2229" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:2229" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2229" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y" at_fn_check_prepare_trace "glr-regression.at:2229" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.c input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:2229" >"$at_check_line_file" (! $BISON_C_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2229" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS -o input input.c \$LIBS" at_fn_check_prepare_dynamic "$CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS" "glr-regression.at:2229" ( $at_check_trace; $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$PREPARSER ./input Nwin" at_fn_check_prepare_dynamic " $PREPARSER ./input Nwin" "glr-regression.at:2229" ( $at_check_trace; $PREPARSER ./input Nwin ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "new" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2229" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$PREPARSER ./input Owin" at_fn_check_prepare_dynamic " $PREPARSER ./input Owin" "glr-regression.at:2229" ( $at_check_trace; $PREPARSER ./input Owin ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2229" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'n', expecting 'o' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$PREPARSER ./input Owio" at_fn_check_prepare_dynamic " $PREPARSER ./input Owio" "glr-regression.at:2229" ( $at_check_trace; $PREPARSER ./input Owio ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "old" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2229" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: \$PREPARSER ./input Nwio" at_fn_check_prepare_dynamic " $PREPARSER ./input Nwio" "glr-regression.at:2229" ( $at_check_trace; $PREPARSER ./input Nwio ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2229: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2229" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'o', expecting 'n' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2229" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_774 #AT_START_775 at_fn_group_banner 775 'glr-regression.at:2230' \ "Predicates: glr.cc" " " 33 at_xfail=no ( printf "%s\n" "775. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %define parse.error verbose %expect-rr 1 %skeleton "glr.cc" %code { #include #include bool new_syntax = false; const char *input = YY_NULLPTR; static int yylex (yy::parser::value_type *lvalp); } %% widget: %? {new_syntax} 'w' id new_args { printf("new"); } | %?{!new_syntax} 'w' id old_args { printf("old"); } ; id: 'i'; new_args: 'n'; old_args: 'o'; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } int yylex (yy::parser::value_type *lvalp) { (void) lvalp; return *input++; } int main (int argc, const char* argv[]) { assert (argc == 2); (void) argc; // First char decides whether new, or old syntax. // Then the input. new_syntax = argv[1][0] == 'N'; input = argv[1] + 1; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:2230" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "glr-regression.at:2230" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2230" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:2230" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2230" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "glr-regression.at:2230" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:2230" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2230" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$CXX \$CPPFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "glr-regression.at:2230" ( $at_check_trace; $CXX $CPPFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$PREPARSER ./input Nwin" at_fn_check_prepare_dynamic " $PREPARSER ./input Nwin" "glr-regression.at:2230" ( $at_check_trace; $PREPARSER ./input Nwin ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "new" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2230" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$PREPARSER ./input Owin" at_fn_check_prepare_dynamic " $PREPARSER ./input Owin" "glr-regression.at:2230" ( $at_check_trace; $PREPARSER ./input Owin ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2230" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'n', expecting 'o' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$PREPARSER ./input Owio" at_fn_check_prepare_dynamic " $PREPARSER ./input Owio" "glr-regression.at:2230" ( $at_check_trace; $PREPARSER ./input Owio ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "old" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2230" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: \$PREPARSER ./input Nwio" at_fn_check_prepare_dynamic " $PREPARSER ./input Nwio" "glr-regression.at:2230" ( $at_check_trace; $PREPARSER ./input Nwio ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2230: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2230" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'o', expecting 'n' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2230" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_775 #AT_START_776 at_fn_group_banner 776 'glr-regression.at:2231' \ "Predicates: glr2.cc" " " 33 at_xfail=no ( printf "%s\n" "776. $at_setup_line: testing $at_desc ..." $at_traceon cat >input.y <<'_ATEOF' %code top { /* -*- c++ -*- */ /* Adjust to the compiler. We used to do it here, but each time we add a new line, we have to adjust all the line numbers in error messages. It's simpler to use a constant include to a varying file. */ #include } %define parse.assert %define parse.trace %glr-parser %define parse.error verbose %expect-rr 1 %skeleton "glr2.cc" %code { #include #include bool new_syntax = false; const char *input = YY_NULLPTR; static int yylex (yy::parser::value_type *lvalp); } %% widget: %? {new_syntax} 'w' id new_args { printf("new"); } | %?{!new_syntax} 'w' id old_args { printf("old"); } ; id: 'i'; new_args: 'n'; old_args: 'o'; %% /* A C++ error reporting function. */ void yy::parser::error (const std::string& m) { std::cerr << m << '\n'; } static int yyparse () { yy::parser p; return p.parse (); } int yylex (yy::parser::value_type *lvalp) { (void) lvalp; return *input++; } int main (int argc, const char* argv[]) { assert (argc == 2); (void) argc; // First char decides whether new, or old syntax. // Then the input. new_syntax = argv[1][0] == 'N'; input = argv[1] + 1; if (getenv ("YYDEBUG")) yydebug = 1; return yyparse (); } _ATEOF if test x"$BISON_TEST_XML" = x1 && test x"$XSLTPROC" != x""; then at_save_special_files mkdir xml-tests # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \\ --graph=xml-tests/test.gv -o input.cc input.y" at_fn_check_prepare_notrace 'an embedded newline' "glr-regression.at:2231" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.gv -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" at_fn_check_prepare_dynamic "COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y" "glr-regression.at:2231" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --color=no -fno-caret --xml=xml-tests/test.xml -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } cp xml-tests/test.output expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2text.xsl \\ xml-tests/test.xml" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2231" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2text.xsl \ xml-tests/test.xml ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } # xml2text and xml2dot always use '•', while --report uses '•' or '.' # depending on the locale, and the test suite is run with the plain # C locale. { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: sed -e 's/•/./g' stdout" at_fn_check_prepare_trace "glr-regression.at:2231" ( $at_check_trace; sed -e 's/•/./g' stdout ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: $at_diff expout "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } sort xml-tests/test.gv > expout { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$XSLTPROC \\ \`COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS=\"\$VALGRIND_OPTS --leak-check=summary --show-reachable=no\"; export VALGRIND_OPTS; bison --print-datadir\`/xslt/xml2dot.xsl \\ xml-tests/test.xml | sort | sed -e 's/•/./g'" at_fn_check_prepare_notrace 'a `...` command substitution' "glr-regression.at:2231" ( $at_check_trace; $XSLTPROC \ `COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS; bison --print-datadir`/xslt/xml2dot.xsl \ xml-tests/test.xml | sort | sed -e 's/•/./g' ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: echo stdout:; tee stdout <"$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } rm -rf xml-tests expout at_restore_special_files fi { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y" at_fn_check_prepare_trace "glr-regression.at:2231" ( $at_check_trace; COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.cc input.y ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } printf "%s\n" "glr-regression.at:2231" >"$at_check_line_file" (! $BISON_CXX_WORKS) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2231" printf "%s\n" "glr-regression.at:2231" >"$at_check_line_file" (test x"$CXX11_CXXFLAGS" == x) \ && at_fn_check_skip 77 "$at_srcdir/glr-regression.at:2231" { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$CXX \$CPPFLAGS \$CXX11_CXXFLAGS \$CXXFLAGS \$LDFLAGS -o input input.cc \$LIBS" at_fn_check_prepare_dynamic "$CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS" "glr-regression.at:2231" ( $at_check_trace; $CXX $CPPFLAGS $CXX11_CXXFLAGS $CXXFLAGS $LDFLAGS -o input input.cc $LIBS ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; cat "$at_stderr" echo stdout:; cat "$at_stdout" at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$PREPARSER ./input Nwin" at_fn_check_prepare_dynamic " $PREPARSER ./input Nwin" "glr-regression.at:2231" ( $at_check_trace; $PREPARSER ./input Nwin ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "new" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2231" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$PREPARSER ./input Owin" at_fn_check_prepare_dynamic " $PREPARSER ./input Owin" "glr-regression.at:2231" ( $at_check_trace; $PREPARSER ./input Owin ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2231" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'n', expecting 'o' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$PREPARSER ./input Owio" at_fn_check_prepare_dynamic " $PREPARSER ./input Owio" "glr-regression.at:2231" ( $at_check_trace; $PREPARSER ./input Owio ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" echo >>"$at_stdout"; printf "%s\n" "old" | \ $at_diff - "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2231" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter at_fn_diff_devnull "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: \$PREPARSER ./input Nwio" at_fn_check_prepare_dynamic " $PREPARSER ./input Nwio" "glr-regression.at:2231" ( $at_check_trace; $PREPARSER ./input Nwio ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo stderr:; tee stderr <"$at_stderr" at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 1 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } { set +x printf "%s\n" "$at_srcdir/glr-regression.at:2231: sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr" at_fn_check_prepare_trace "glr-regression.at:2231" ( $at_check_trace; sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr ) >>"$at_stdout" 2>>"$at_stderr" 5>&- at_status=$? at_failed=false $at_check_filter echo >>"$at_stderr"; printf "%s\n" "syntax error, unexpected 'o', expecting 'n' " | \ $at_diff - "$at_stderr" || at_failed=: at_fn_diff_devnull "$at_stdout" || at_failed=: at_fn_check_status 0 $at_status "$at_srcdir/glr-regression.at:2231" $at_failed && at_fn_log_failure $at_traceon; } set +x $at_times_p && times >"$at_times_file" ) 5>&1 2>&1 7>&- | eval $at_tee_pipe read at_status <"$at_status_file" #AT_STOP_776